Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

opengl - possibility of a mirroring shader?

Until today, when I wanted to create reflections (a mirror) in opengl, I rendered a view into a texture and displayed that texture on the mirroring surface.

What i want to know is, are there any other methods to create a mirror in opengl?

And 2. can this be done lonely in shaders (e.g. geometry shader) ?

like image 383
bricklore Avatar asked Jan 26 '26 17:01

bricklore


1 Answers

Ray-tracing. You can write a ray-tracer in the fragment shader (every fragment follows a ray). Ray-tracers can perfectly deal with reflection (mirroring) on all kinds of surfaces.

You can find an OpenGL example here and a WebGL example including mirroring here.

like image 74
Danny Ruijters Avatar answered Jan 28 '26 08:01

Danny Ruijters



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!