Hi,
I have made a shader which worked without the specular part. But when i add the specular lighting, the reflection of the specular part seems to be on all the mesh and not concentrated on a little part, is it normal ?
otherwise what can i do ?
PS :does the specular part have to be in a separated color than the primary color ?
if yes how do it ? the gl_secondary_color is just accessible in read only.
gl_FragCoord is not the coordinate of the fragment in world coordinates, but screen coordinates. To know the fragment position in world coordinates, pass the vertex position as a varying variable
i have declared the varying variables also in the fragment shader and replaced gl_fragCoord by the new varying variable but now i have a black screen
i do this in my vertex shader :
Lighting is normally done in eye space and that is gl_ModelViewMatrix * gl_Vertex;
Read the OpenGL 2.0 specs (2.11 and 2.14.1).
gl_Position is not in that space as it is calculated by gl_ModelViewProjectionMatrix * gl_Vertex;
i have normalized the vectors in the fragment shader, it didn’t change something but after this i have removed attenuation and the model is lighted, however i don’t see the specular part on the mesh and i would like that it works with attenuation, do you know how to do ?