Just made the light the location of the camera, gives nice vibes

This commit is contained in:
Conál 2024-02-06 11:38:44 -05:00
parent dfd0c57c59
commit 6c317c8ac3
2 changed files with 4 additions and 4 deletions

View File

@ -19,10 +19,10 @@ layout (set = 0, binding = 0) uniform Matrices {
layout (set = 0, binding = 1) uniform sampler2D heightmap; layout (set = 0, binding = 1) uniform sampler2D heightmap;
void main() { void main() {
vec3 light_pos = vec3(10.0*cos(time), 10.0, 0.0); //vec3 light_pos = vec3(10.0*cos(time), 10.0, 0.0);
vec3 L = normalize(light_pos-pos); vec3 L = normalize(cam_pos-pos);
float r = length(light_pos-pos); float r = length(cam_pos-pos);
float t = clamp(dot(L, norm), 0.0, 1.0) * 20.0/(r*r); float t = clamp(dot(L, norm), 0.0, 1.0) * 20.0/(r*r);
FragColor = vec4(t, t/2.0, t*2.0, 1.0); FragColor = vec4(t*norm, 1.0);
} }

Binary file not shown.