Jump to content
  • Advertisement
Sign in to follow this  
Kaptein

Planar reflection

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

Hey guys! I have done some thinking, and I can't see an obvious way to render my planar reflections without rendering "the mirror" first.

My mirror is expensive to render twice, compared to just some planar equation. Hence the planar reflection.

So, is there any way to write to the stencil buffer from say the shader rendering the mirrored objects? And then discarding say non-zero stencil values? Any quick example would be great.

 

EDIT:

http://web.cse.ohio-state.edu/~hwshen/781/Site/Slides_files/reflection.pdf

 

I imagine I can somehow mark my reflected objects with stencil values, then when I draw my reflector I could discard non-zero stencil values... somehow.

 

EDIT2:

I'm using clip planes, it seems like much a much simpler procedure, and just what clipplanes were meant to do!

http://github.prideout.net/clip-planes/

 

... Which means that with a constant water level (Y=64), all I need to do in the shader is

gl_ClipDistance[0] = position.y - 64.0;

with glEnable(GL_CLIP_DISTANCE0);

Edited by Kaptein

Share this post


Link to post
Share on other sites
Advertisement
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!