I’m tryng to figure out what i’m doing wrong, but i just can’t see it.
Basically, i’m just doing shadowmapping.
I have a light source, and before rendering the scene to a texture, i do this :
And this effectively captures what’s below the light.
Now, i wanted to do the same with what is above the light, but flipping the light position(origin/destiny), or the up vector to (0,-1,0) is not working at all.
Am i doing something wrong ??
Look down at your feet, and then turn around so that the top of your head points 180 degrees from where it was originally. THAT’S what you’re doing by changing the up vector. What you WANT to do is change the “look-at” vector (your ‘dest’ vector) so that you actually look in the opposite direction.
For example, if your origin is (10, 15, 25) and you want to look down the +Z axis, you would set the destination vector to be origin + (0, 0, 1). Setting it to origin + (0, 0, -1) will give you the -Z axis.
The up vector just determines which way “up” is with respect to the way the camera is rotated. If this is confusing, go back to my “look at the ground” example; try to see that there are an infinite number of ways you can change the up vector and still be looking at the same spot.
Hope that helps!