You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 28, 2021. It is now read-only.
void render(vec3 vertex, vec3 normal, mat4 viewmodel, mat4 projection, vec3 light[4])
{
vec4 position_camspace = viewmodel * vec4(vertex, 1);
// normal in world space
o_normal = normal;
// direction to light
o_lightdir = normalize(light[3] - vertex);
// direction to camera
o_vertex = -position_camspace.xyz;
// screen space coordinates of the vertex
gl_Position = projection * position_camspace;
}
which is used for the standard mesh rendering, the light position is relative to the vertex
which is in model space , it should be relative to model*vertex (world space) the position in camspace
I would issue a PR but in entails changing the signature of render , which in turn would cause a wide change in the various calls to render.
The text was updated successfully, but these errors were encountered:
A quick run through some openGL tutorials reveals that the convention is that light position is given in
eye (Camera) space. therefore it is easy to issue a PR , I am on it.
TsurHerman
changed the title
Light is given in model space and not in world space in standard mesh rendering
Light is given in model space and not in eye space in standard mesh rendering
Jul 25, 2017
Hi Simon,
in util.vert function render
which is used for the standard mesh rendering, the light position is relative to the vertex
which is in model space , it should be relative to
model*vertex (world space)the position in camspaceI would issue a PR but in entails changing the signature of render , which in turn would cause a wide change in the various calls to render.The text was updated successfully, but these errors were encountered: