-
-
Re: Reflections
No, OpenGL cannot "automatically" create
reflections for you. OpenGL just draws the
one triangle (or quad, or strip) that you
ask it to, with exactly the texture, color
and lighting you ask it to. OpenGL only
uses information knowable to it in that
instance.
Yes, you have to do all the extra
calculations and multiple render passes to
get reflection into your engine. What's
worse, OpenGL doesn't (yet?) support the
cubic environment mapping way of doing
reflections, which is easier to set up and
create using hardware rendering (basically
you render from the point-of-view of the
reflective "thing" into an area which you
then turn around and use as a texture).
Good luck! As you say, it can become
"hectic".
-
Re: Reflections
OpenGL support cubic environment mapping with GL_ARB_texture_cube_map.
The core(without extensions) OpenGL supports SPHERE_MAP texture generation (predominantly used for environment mapping and not actual reflections).There is extensions like GL_NV_texgen_reflection which make the life easier ,but doing your own math is (almost always ) faster in current hardware.
The most optimal way to get a reflection-mirror is to draw your geometry, flip an axis and redraw the geometry (with optional stencil testing for optimal performance ).
Forget what you have learned from Pov-Ray
-
-
Re: Reflections
My method works only with planes .If you want reflection on a arbitrary shape ,then you have to render your scene(from the point-of-view of the
reflective "thing" as bgl said) to a texture(read the color buffer and store it as a texture) and map that texture to the sphere(here is the SPHERE_MAP texgen mod ) or the other shape. But this is very slow because each frame you upload a new texture to the hardware.
-
-
Re: Reflections
I just figured out a pretty crap way to make a reflection. I had a 3D cube with a reflection off of a floor. First I rendered the cube then I made the floor using GL_QUADS and I added some blending to make it transparent and then I rendered the same exact 3D cube except that i put directly under the original cube and the floor, to make a "reflection." Oh yeah I used blending for the second square too.
Hope this helps somebody
-
Re: Reflections
The Nvidia site(http://www.nvidia.com/Developer.nsf) have a heavy load of examples .
Keep in mind that the reflections around spheres, cylinders etc are called environment mapping .The reflection term is used for planar reflections.
I’m clearing that to help you find the right document.
-
Re: Reflections
Ok about the above messages... I used a program called blender which uses the above methods for "reflections". I know what you mean but does anyone have code to make a rendered scene a texture? Also as a second question related to that does anyone also have an OpenGL scene to Bitmap/tga/whatever code? For instance rendering a scene to a bitmap/tga/whatever?
cwhite40
-
Re: Reflections
I haven't tried it with a texture yet. Nehe has a tutorial about loading tga files. the url is http://nehe.gamedev.net
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules