• Advertisement
Sign in to follow this  

Rear View Camera Matrix

This topic is 2410 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What I thought would be rather simple has turned into a complicated task. I’m rendering to a surface for a reflection texture I can use like a rear view mirror in a car. The problem is my view matrix. I build it using a lookAt matrix with the camera’s position, target, and up vector. I thought I could simply invert the camera target (-camera target) when building the matrix and I’d be good to go… but I’m not, I get strange results when the camera goes from a positive X Y or Z position into a negative. As long as the camera’s position is in the positive all is well but as soon as I back out to a negative XY or Z position the reflection starts to roll and eventually ends up looking forward and not back.

Am I overlooking something?

Share this post


Link to post
Share on other sites
Advertisement
It's probably the forward vector you want to negate, rather than the target point.

If you're using a 'look at' function that takes a position and a target point, you should be able to compute the adjusted target point as follows (pseudocode):

vector3 forward = target - position;
vector3 adjusted_target = position - forward;

Share this post


Link to post
Share on other sites

It's probably the forward vector you want to negate, rather than the target point.

If you're using a 'look at' function that takes a position and a target point, you should be able to compute the adjusted target point as follows (pseudocode):

vector3 forward = target - position;
vector3 adjusted_target = position - forward;




That did it JYJK. Thanks man!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement