Don't pre-rotate light source

This commit is contained in:
Grant Sanderson 2023-01-16 19:34:20 -08:00
parent c3cd64f68c
commit 1f613953d6
2 changed files with 3 additions and 5 deletions

View file

@ -490,9 +490,7 @@ class Camera(object):
# Orient light # Orient light
rotation = frame.get_inverse_camera_rotation_matrix() rotation = frame.get_inverse_camera_rotation_matrix()
offset = frame.get_center() offset = frame.get_center()
light_pos = np.dot( light_pos = self.light_source.get_location()
rotation, self.light_source.get_location() + offset
)
cam_pos = self.frame.get_implied_camera_location() # TODO cam_pos = self.frame.get_implied_camera_location() # TODO
self.perspective_uniforms = { self.perspective_uniforms = {
@ -501,7 +499,7 @@ class Camera(object):
"camera_offset": tuple(offset), "camera_offset": tuple(offset),
"camera_rotation": tuple(np.array(rotation).T.flatten()), "camera_rotation": tuple(np.array(rotation).T.flatten()),
"camera_position": tuple(cam_pos), "camera_position": tuple(cam_pos),
"light_source_position": tuple(light_pos), "light_position": tuple(light_pos),
"focal_distance": frame.get_focal_distance(), "focal_distance": frame.get_focal_distance(),
} }

View file

@ -1,4 +1,4 @@
uniform vec3 light_source_position; uniform vec3 light_position;
uniform vec3 camera_position; uniform vec3 camera_position;
uniform vec3 shading; uniform vec3 shading;