Replies: 1 comment
-
Yes, camera coordinate system is left-handed. so you need to transform |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a very simple shader that uses one light source, defined as a uniform.
I am interpreting its coordinates in camera space (or so I think).
The funny thing is, that light source appears to be in a let-handed coordinate system.
At least, when I change its coordinates live, it looks like those coordinates are in a left-handed coord system.
Could that be? Is there a mistake on my part?
Best regards, Gabriel
Encl.:
Code of the vertex shader (just the relevant parts):
uniform mat4 matModelToWorld;
uniform mat4 matCamera;
uniform vec3 LightPos;
out vec3 fNormal;
out vec3 fLightVec;
void main()
{
vec4 vpos_cam_space = matCamera * matModelToWorld * vec4(vPosition, 1.0);
gl_Position = matProjection * vpos_cam_space;
vec3 vpos3 = vpos_cam_space.xyz / vpos_cam_space.w;
fLightVec = vec3( LightPos - vpos3 );
fNormal = ( matCamera * matModelToWorld * vec4(vNormal, 0.0) ).xyz;
}
Beta Was this translation helpful? Give feedback.
All reactions