Skip to main content
GameDev.net gamedev.net
🔒 Locked

Fading Reflection

Started by TjMax Jan 22, 2008 at 6:39 AM 0 replies 800+ views
Original Post
TjMax
TjMax
I am trying to create a simple mirrored reflection of a textured box where the reflection fades out as it gets deeper, rather than just being a perfect mirror image. Is it possible for me to achieve this effect using only OpenGL 1.1 headers? (Windows) I have tried blending the textures with another (code generated) texture containing a linearly graded alpha channel. Now I have had some degree of success with this method however it only works on a solid coloured background. Really, I need to use a background image but when I do so it reveals the opaque part of the blended texture. As the box textures are user provided it would not be practical to add the graded alpha channel directly to these and I would prefer to make the depth of reflection adjustable. Perhaps I could do this by merging the alpha channel of the graded texture using multi-texturing although I would rather avoid using extensions if at all possible. Maybe there’s a better way, I am still very much a novice. I will resort to using extensions if absolutely necessary. Could someone please offer me some advice either way?
Vilem Otte
Vilem Otte
I don't know, if this could be possible without shaders and rendering-to-texture. Shaders using GLSL - GL_ARB_vertex_program, GL_ARB_fragment_program and GL_ARB_shading_languague100.
If you have them (I presume you know how to use shaders), then store in alpha chanel of reflection texture objects distance from reflection plane. Then just use alpha channel like this - gl_FragColor = vec4(reflectionTexture.xyz * reflectionTexture.w, 1.0); where reflectionTexture is render target of reflection and .w component is alpha channel of that texture.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.