Sign in to follow this  

Reflective surface

This topic is 1982 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

I'm trying to think of / find a way to write a shader that reproduces this effect where an object passed to said shader has a reflection of itself below itself like in the picture below. My best idea so far is to do a second inverted pass and then have some sort of function to determine how alpha'd out that particular part of the image needed to be. My problem is mainly that while I can easily just do a second pass and tell all the verts "Hey man, do a 180" that would only result in a second image being right on top of my first, upside-down.
[url="http://aefreemart.com/wp-content/uploads/2007/11/wavylogo.jpg"][img]http://aefreemart.com/wp-content/uploads/2007/11/wavylogo.jpg[/img][/url]

If I posted this in the wrong section or this post has been discussed before please forgive me :( I don't want to annoy anyone.

Thank you for any and all tips / advice!

Share this post


Link to post
Share on other sites
You'll find a lot of info by searching for "planar reflections". N.B. older literature will explain how to do it via the stencil buffer ([i]where you do your main pass 1st, and relfection pass 2nd[/i]), and newer literature will more likely do it via render-targets ([i]where you do the reflection pass 1st to a texture, then the main pass 2nd[/i]).

If doing it via the render-reflected-scene-to-texture-and-project-onto-mirror-geometry technique, then when rendering your 1st/reflection pass, you can fade the alpha based on the distance from the current pixel to the clipping/mirror plane.

Share this post


Link to post
Share on other sites
Planar Reflections was a great read and I learned plenty from it. I found the easiest way to achieve what I wanted ( I'm using Unity so this was much simpler ) was to draw the objects I wanted reflected to a second texture ( in this case a RenderTexture in Unity ) and the camera drawing to this texture was inverted while doing so. I just simply positioned this second texture below the first one and applied a basic fading shader to get the results I wanted! thanks for the suggestions everyone!

Share this post


Link to post
Share on other sites

This topic is 1982 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this