Closed XiaofanLinUS closed 2 years ago
Well, it is exactly the same as for the camera: 1) you set up the view direction with the code that looks like this: https://github.com/ssloy/tinyrenderer/blob/dbc5d9287610e993a09bce89dec459162c925abe/our_gl.cpp#L16
2) you set the distance to the light via the projection matrix https://github.com/ssloy/tinyrenderer/blob/dbc5d9287610e993a09bce89dec459162c925abe/our_gl.cpp#L12
k
I see that you use orthogonal projection matrix to create shadow map.
However, I am curious if it is possible to use perspective matrix instead. I am not sure if my tuition is right. For directional light like sun, orthogonal projection matrix is used since the light rays are parallel. But for the point light, since light converges to a single point, it is better to use perspective matrix?
If it is possible for point light to use perspective projection to create shadow map. How are the parameters in the perspective matrix adjusted to match a proper point light condition. Thanks.
Sincerely, Xiaofan