Hi all,
Finally i find where is the lighting problem, it's the specular
computation. Here's the change i made in the main vertex shader:
void DirectionalLight(in int
i, \n"
in vec3
normal, \n"
inout vec4
ambient, \n"
inout vec4
diffuse, \n"
inout vec4
specular) \n"
{
\n"
" float nDotVP; // normal . light
direction \n"
" float nDotHV; // normal . light half
vector \n"
" float pf; // power
factor \n"
"
\n"
" nDotVP = max(0.0,
dot(normal, \n"
"
normalize(vec3(gl_LightSource[i].position)))); \n"
" nDotHV = max(0.0,
dot(normal, \n"
"
vec3(gl_LightSource[i].halfVector))); \n"
"
\n"
"//CHANGE HERE
\n"
" // if (nDotVP ==
0.0) \n"
" // pf =
0.0;
\n"
" //
else
\n"
" // pf = pow(nDotHV,
gl_FrontMaterial.shininess); \n"
"//CHANGE TO
\n"
" if (nDotVP >
0.0) \n"
" pf = pow(nDotHV,
gl_FrontMaterial.shininess); \n"
"
else
\n"
" pf = 0.0;
\n"
"//END CHANGE
\n"
" ambient += gl_LightSource[i].ambient;
\n"
" diffuse += gl_LightSource[i].diffuse * nDotVP;
\n"
" specular += gl_LightSource[i].specular *
pf; \n"
"
\n"
"}
\n"
There are similarly problem in spot and point light.
I'm not understand exactly why, maybe equality check on float ?
best regard
Hi Wojtek,
Yes reference frame is set in StandardShadowMap, i didn't notice it
yesterday.
I made test and i found something new:
It's not a lod problem but a Lighting problem (geometry is good).
Actually i take a look in StandardShadowMap shader, if you have any idea.
[...]
Find where is the problem, gl_Color is miss compute (for my terrain
db) by the main vertex shader, by using a constant one in fragment i
solve
my lighing problem. I' m going to make my own vertex shader to keep
the lighting computation.
Thanks
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org