Updated mesh shaders (better lighting with specular)
This commit is contained in:
parent
4807931164
commit
94f6b4a074
6 changed files with 17 additions and 19 deletions
|
|
@ -18,7 +18,7 @@ layout (binding = 0) uniform UBO
|
|||
layout (location = 0) out vec3 outNormal;
|
||||
layout (location = 1) out vec3 outColor;
|
||||
layout (location = 2) out vec2 outUV;
|
||||
layout (location = 3) out vec3 outEyePos;
|
||||
layout (location = 3) out vec3 outViewVec;
|
||||
layout (location = 4) out vec3 outLightVec;
|
||||
|
||||
void main()
|
||||
|
|
@ -27,6 +27,10 @@ void main()
|
|||
outColor = inColor;
|
||||
outUV = inUV;
|
||||
gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0);
|
||||
outEyePos = (gl_Position).xyz;
|
||||
outLightVec = normalize(ubo.lightPos.xyz - outEyePos);
|
||||
|
||||
vec4 pos = ubo.model * vec4(inPos, 1.0);
|
||||
outNormal = mat3(ubo.model) * inNormal;
|
||||
vec3 lPos = mat3(ubo.model) * ubo.lightPos.xyz;
|
||||
outLightVec = lPos - pos.xyz;
|
||||
outViewVec = -pos.xyz;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue