0.4.3 Changed vignette
Hi,
My vignette no longer works, with 0.4.3. I've read a lot of info on the vignette being wrong in 0.4.3, but I'm not sure this is the same issue.
I'm using the extended mode.
This is what I want (it's what it looked like in 0.4.2):

This is what it looks like in 0.4.3:

I read out the vignette factor values that I got, and noticed some where actually below 0, which doesn't make sense to me. Isn't the vignette just there to darken the image, so it should be used to multiply the colour with - meaning it should go from 0 to ? For some reason I get values between -0.37745 and +1.
Is this the issue everyone else has been reporting? Or is this something different?
The code setting up the mesh:
Vertex shader:
Fragment shader:
This is all running in OGRE 1.9.0.
Edit: When setting
then I get the expected result (with a larger vignette). The question remains, though - why negative values?
My vignette no longer works, with 0.4.3. I've read a lot of info on the vignette being wrong in 0.4.3, but I'm not sure this is the same issue.
I'm using the extended mode.
This is what I want (it's what it looked like in 0.4.2):

This is what it looks like in 0.4.3:

I read out the vignette factor values that I got, and noticed some where actually below 0, which doesn't make sense to me. Isn't the vignette just there to darken the image, so it should be used to multiply the colour with - meaning it should go from 0 to ? For some reason I get values between -0.37745 and +1.
Is this the issue everyone else has been reporting? Or is this something different?
The code setting up the mesh:
for( unsigned int i = 0; i < meshData.VertexCount; i++ )
{
ovrDistortionVertex v = meshData.pVertexData[i];
manual->position( v.ScreenPosNDC.x,
v.ScreenPosNDC.y, 0 );
manual->textureCoord( v.TanEyeAnglesR.x,//*UVScaleOffset[0].x + UVScaleOffset[1].x,
v.TanEyeAnglesR.y);//*UVScaleOffset[0].y + UVScaleOffset[1].y);
manual->textureCoord( v.TanEyeAnglesG.x,//*UVScaleOffset[0].x + UVScaleOffset[1].x,
v.TanEyeAnglesG.y);//*UVScaleOffset[0].y + UVScaleOffset[1].y);
manual->textureCoord( v.TanEyeAnglesB.x,//*UVScaleOffset[0].x + UVScaleOffset[1].x,
v.TanEyeAnglesB.y);//*UVScaleOffset[0].y + UVScaleOffset[1].y);
//manual->colour( v.VignetteFactor, v.VignetteFactor, v.VignetteFactor, v.TimeWarpFactor );
manual->colour( v.VignetteFactor, v.VignetteFactor, v.VignetteFactor, v.VignetteFactor );
}
for( unsigned int i = 0; i < meshData.IndexCount; i++ )
{
manual->index( meshData.pIndexData[i] );
}
Vertex shader:
#version 130
// Values automatically defined by Ogre/OpenGL:
attribute vec4 vertex;
attribute vec2 uv0; // Red channel
attribute vec2 uv1; // Green channel
attribute vec2 uv2; // Blue channel
attribute vec4 colour; // Vertex Colour
// Load in values defined in the material:
uniform mat4 worldViewProj;
uniform vec2 eyeToSourceUVScale;
uniform vec2 eyeToSourceUVOffset;
uniform mat4 eyeRotationStart;
uniform mat4 eyeRotationEnd;
varying vec4 gl_FrontColor;
vec2 timewarpTexCoord( vec2 texCoord, mat4 rotMat )
{
vec3 transformed = (rotMat * vec4( texCoord.xy, 1, 1) ).xyz;
vec2 flattened = transformed.xy / transformed.z;
return eyeToSourceUVScale * flattened + eyeToSourceUVOffset;
}
void main(void)
{
/*float timewarpLerpFactor = 0.0;
mat4 lerpedEyeRot = eyeRotationStart * (1 - timewarpLerpFactor) + eyeRotationEnd * timewarpLerpFactor;
gl_TexCoord[0] = vec4( timewarpTexCoord( uv0, lerpedEyeRot ), 0.0, 0.0 );
gl_TexCoord[1] = vec4( timewarpTexCoord( uv1, lerpedEyeRot ), 0.0, 0.0 );
gl_TexCoord[2] = vec4( timewarpTexCoord( uv2, lerpedEyeRot ), 0.0, 0.0 );*/
gl_TexCoord[0] = vec4( eyeToSourceUVScale * uv0 + eyeToSourceUVOffset, 0.0, 0.0 );
gl_TexCoord[1] = vec4( eyeToSourceUVScale * uv1 + eyeToSourceUVOffset, 0.0, 0.0 );
gl_TexCoord[2] = vec4( eyeToSourceUVScale * uv2 + eyeToSourceUVOffset, 0.0, 0.0 );
gl_Position = worldViewProj * vertex;
gl_FrontColor = colour;
}
Fragment shader:
uniform sampler2D diffuseMap;
void main(void)
{
float red = texture2D(diffuseMap, gl_TexCoord[0].xy).r;
float green = texture2D(diffuseMap, gl_TexCoord[1].xy).g;
float blue = texture2D(diffuseMap, gl_TexCoord[2].xy).b;
gl_FragColor = vec4( red, green, blue, 1.0 )*gl_Color;
//gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy);//vec4( red, green, blue, 1.0 );
//gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0 );
}
This is all running in OGRE 1.9.0.
Edit: When setting
vignette = std::max( v.VignetteFactor, (float)0.0 );
then I get the expected result (with a larger vignette). The question remains, though - why negative values?
