Jump to content

Real Mirror


Ameshi
 Share

Recommended Posts

Hello guys,

 

I'm trying to do some mirrors, and in my first try I used a Camera render target.

Camera render target looks like a good solution for security cameras and such, but as a mirror not so much :/

 

kHjVpBC.jpg

 

Anyone know how I could do a mirror, like the one in the video? I mean reflect stuff based the angle that you look at it.

 

 

Link to comment
Share on other sites

The probes aren't dynamic, so you won't be able to see the player. The SSLR shader won't work because the back of the player will be culled in a third person game and hidden in a first-person game. Basically, you can't use that shader for anything that's not currently displayed on camera.

Link to comment
Share on other sites

Yep, you've basically got to position and rotate the camera opposite of the player eye, across the plane.

 

post-1-0-22509800-1468452086.jpg

 

I haven't done this, but our water reflections work the same way. Now with water reflection on a vertical plane, I scale the camera by 1,-1,1 so the image is inverted. You might have to experiment with this, or maybe just drawing the image backwards on the mirror surface will work.

 

Finally, you will need a clipping plane across the mirror surface, so the reflection doesn't include objects behind the mirror. You can transform the plane of the mirror to camera space (Transform::Plane()) and send this to your mirror shader, then set the super-secret GraphicsDriver clipplane member to this:

graphicsdriver->clipplane[0] = plane;

 

This plane will then be uploaded to every shader.

 

This requires C++, so the pro edition is needed. It's not really supported right now, but it is possible to implement and if you get anywhere with it I'm happy to do what I can on my end to make it easier. A reusable mirror plane prefab would be a pretty cool addition to the Workshop.

  • Upvote 2

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...