dilevin / computer-graphics-shader-pipeline

Computer Graphics Assignment about the Shader Pipeline
2 stars 5 forks source link

How to rotate the light in lit.fs? #22

Closed Geetchopra closed 5 years ago

Geetchopra commented 5 years ago

I don't know how to rotate the light in lit.fs. I can calculate Blinn phong color appropriately but cannot get the light to rotate independently from the spheres. If I try to call functions like model or rotate_about_y they give errors. I would be grateful if someone could guide me on what to do. Thank you!

rin-23 commented 5 years ago

say you are using a directional light.
Your light vector(direction) has 3 components x,y,z say you want your light to rotate in x,z plane which means y component will be a constant all you need is to calculate x,z coordinate which should lie on a circle. how can you calculate x,z coordinates on a circle (think about polar coordinates)

thats just one way to do it

Geetchopra commented 5 years ago

That was perfect! It does not need to be accurate to the gif in the handout, right?

rin-23 commented 5 years ago

No it doesnt need to be exactly same