vehicle rear mirrors

Hi,

I am trying to simulate a vehicle mirror, and having a difficult time with it.
Simply adding a camera that looks behind is not a solution, as there’s no reflection involved. In other words, what appears in the left side of the mirror is actually on the right side of the user. This is quite counter-intuitive and unnatural.
So, my second solution was to render on a cubemap texture, rendering a cube with this texture and then making a camera show one face of the cube. However this does not have the results I was hoping or… :cry:
Does anyone have another solution/suggestion on how to achieve a mirror effect?

Thanks in advance,
Alin

http://www.unifycommunity.com/wiki/index.php?title=MirrorReflection2

Have you tried that out?

No, I haven’t. Thanks a lot. I’ll give it a shot and post the answers

Is there any way to make a rear view mirror in Unity Indie?

You can use another camera. Contrary to what’s said in the first post, this is a solution…to get mirroring, change the camera matrix.

–Eric

And how specifically do I modify the camera matrix in order to achieve this effect?

Add the following code somewhere in the Start function of a script on the camera:-

var mat: Matrix4x4 = camera.projectionMatrix;
mat[0, 0] = -mat[0, 0];
camera.projectionMatrix = mat;

Note that this doesn’t work if you just get and set the [0, 0] value directly - you have to copy the matrix, change it and then reset it.

Does this effort the culling thing? After I set the projection matrix, it seems that the camera is opposite to the normal direction, and things are just rendered back face.

This code does give a proper mirror effect. However the entire terrain in the camera view which the script was run against now looks like water - see attached image.

306631--10827--$image2_835.jpg

I’ve got the same issue. did you figure out a solution?

Hi all,

How would one define the resolution of this effect? I put it in an object, but it’s really pixelated.

Please keep in mind that I’m not a coder, so make sure you really dumb it down.

Thanks

The rear view camera’s resolution should be the same as the main view. Are you finding the textures are pixellated or the geometry edges?

I’m still having this problem. Without the mirror script, the camera works ok. With the mirror script, everything is mirrored, but the terrain is gone (except the mountains in the distance or the trees etc.).

bump ?

Anyone having a clue for inverting the cull on a projection matrix please ?
I confess i’d be happy to avoid loosing days diving back to my algebra courses, and i know
it’s only 1 or 2 signs to put here and there.

pleaaaaase :slight_smile:

have a nice day

Why not render to texture then flip the texture in the transform.scale?

1 Like