I tried to create the post-effects, use of Common/Pos.vert and my custom.frag
result
then add the offset of the red channel
result
Why, instead of the offset of the red channel there are red lines?
I tried to create the post-effects, use of Common/Pos.vert and my custom.frag
Which effect do you try to do ?
texCoord in range ([0.0,1.0], [0.0,1.0]) if you substract (1.0,0.0) you will have a negative texCoord params, behavior depends of clamp (see OpenGL - Textures). IMHO (hypothesis), you’re in GL_CLAMP_TO_EDGE => your red is always with a texCoord(0, [0.0,1.0]) so if the pixel at the “begin of the line” is red, you’ll see red line.
yeah, david is right. I think i understand what you try to create. If i get it correctly you would like to be able to set the offset in pixels.
vec2f blueTexCoord=inTexCoord-(blueOffset/screenResolution);
uniform vec2 g_Resolution;
uniform sampler2D m_Texture;
uniform sampler2D m_DepthTexture;
in vec2 texCoord;
out vec4 outFragColor;
void main () {
vec2 greenTexCoord = texCoord - (vec2(1,0) / g_Resolution);
vec4 redValue = texture2D(m_Texture, texCoord);
vec4 greenValue = texture2D(m_Texture, greenTexCoord);
vec4 blueValue = texture2D(m_Texture, texCoord);
outFragColor = vec4(0, greenValue.g, 0, 1.0);
}
Hm solid green is a strange output.
Sure the texCoord and g_Resolution is porperly passed to the shader?
texCoord would be easy to debug… not sure about g_Resolution. (as a note: you have to add Resolution to your j3md)
(as a note: you have to add Resolution to your j3md)thanks :)
Fine, you 're creating blue red stereoscopic 3D effect (http://en.wikipedia.org/wiki/Anaglyph_3D ).
Beside that, this effect was heavily in use in battlefield 4. For cutscenes, menu changes, teasers… like everywhere.