Hi, Paul and Michael

Frist Thank you for your suggestion.
I use the your method, and output show correctly in normal rendering, but when 
I use my deferred render, it has aliasing, I use a TextureRectangle as 
normal_sampler, below is my fragment shader:
#version 120

uniform sampler2D normal_sampler;
varying vec3 normal;
centroid varying vec4 texcood;        //texcoord is gl_Position from vertex 
shader

void main()
{
//vec3 snormal = 2.0*texture2DRect(normal_sampler, gl_FragCoord.st).xyz - 
vec3(1.0, 1.0, 1.0);
vec2 tex_coord = 0.5*texcood.st / texcood.w + 0.5;
vec3 snormal = 2.0*texture2D(normal_sampler, tex_coord).xyz - vec3(1.0, 1.0, 
1.0);
float diffuse = dot(normalize(snormal), -1.0*gl_LightSource[0].spotDirection);
gl_FragColor = vec4(diffuse, 0.0, 0.0, 1.0);
}

I also change the filter of normal sampler to linear, it also makes the same 
result.
you can also see the screen output in attachment:


Thank you!

Cheers,
Kai

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=26053#26053



<<attachment: 4.png>>

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to