model-view-based-lighting.vert
The Phong Lighting with model-view optimizationgolxzn
glsl
17 days ago
575 B
2
Indexable
Never
[glsl]
#version 300 core layout(location = 0) in vec3 a_position; layout(location = 1) in vec3 a_normal; layout(location = 2) in vec2 a_uv; layout(location = 0) out vec3 frag_position; layout(location = 1) out vec3 frag_normal; layout(location = 2) out vec2 frag_uv; uniform mat4 u_model_view; uniform mat4 u_projection; uniform mat3 u_normal_matrix; void main() { vec4 position = u_model_view * vec4(a_position, 1.0); gl_Position = u_projection * position; frag_position = position.xyz; frag_normal = u_normal_matrix * a_normal; frag_uv = a_uv; }
Leave a Comment