Jump to content
  • Advertisement
Sign in to follow this  

Planar reflection

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





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.



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



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

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!