Jump to content
  • Advertisement
Sign in to follow this  
ZackHeckman

Reflective surface

This topic is 2202 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.
wavylogo.jpg

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
Advertisement
I need it to be discernible that the image below the object is a reflection, so not 100% crystal clear but anything resembling it will be perfecto

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 (where you do your main pass 1st, and relfection pass 2nd), and newer literature will more likely do it via render-targets (where you do the reflection pass 1st to a texture, then the main pass 2nd).

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!