View Full Version : Projected texture coordinate generation
07-12-2001, 03:48 PM
OpenGL can already generate texture coordinates for environment mapping (which is almost useless without a fast way to actually generate enviro. maps on the fly, BTW). We should have a similiar option for generating texture coordinates for projected textures. This would be useful for all sorts of things: projection effects (of course), light mapping, caustics, shadow maps, decailing, etc.
[This message has been edited by Decimal Dave (edited 07-13-2001).]
07-14-2001, 04:14 AM
hmmm, how about making use of the good old texture matrix.
07-15-2001, 10:49 AM
Actually, lightmapping (or simulating a projected light source) is a bit more involved than just using the projected texture coordinates. I'm not convinced that SGI's documentation < http://www.sgi.com/software/opengl/advanced97/notes/node70.html > on lightmapping is even correct. It only uses the vertices of a plane to compute their corresponding texture coordinates. For really good lightmapping, one must also consider the normals of each vertex as well as the distance from the light source. It is possible for a surface to be nearly perpendicular to the vector from the light, though still very close to it, making it appear dim. Correct me if my intrepretation is wrong; this is just the impression that I get reading documentation on this technique.
07-18-2001, 08:48 PM
The SGI documentation is correct on the topic of lightmaps. That's the standard way of doing lightmapping and it doesn't involve normals but you pretend there is a single normal per surface. If you want to involve normals, then this will probably involve "adjusting" the lightmap texture or the polygon's texture, so have a look at register_combiners. Perhaps even a normal map can help.
>>> It is possible for a surface to be nearly perpendicular to the vector from the light, though still very close to it, making it appear dim. <<<<
What kind of light source has that effect? If a point light was very very close to a surface, it would give that appearance but the region (a single pixel?) that is closest to it would appear very bright. Yea, I know GL doesn't do perpixel, but per vertex lighting discusts me. :P
07-26-2001, 07:10 AM
>>>>> It is possible for a surface to be nearly perpendicular to the vector from the light, though still very close to it, making it appear dim. <<<<
What kind of light source has that effect?<<
This can be shown by testing a real plane (a sheet of paper) against a point light source (a small LED?). Hold the paper with a fixed corner very close to the LED and the normal at the corner parallel with the vector toward the light. At the corner, then, would be the brightest possible shade of reflected light. Now, rotate the paper about the fixed corner such that the normal is now orthogonal to the vector toward the light. Observe how the reflected light from the paper is very dim, yet the distance to the corner (vertex?) has not changed. If SGI's implementation were correct, we woud all be livin' it up in much warmer temperatures on Earth.
07-27-2001, 01:57 PM
That's the physics of light. If light vector is orthogonal to normal, then no reflection occurs. SGI is using typical lighting equations done for computer graphics.
BTW, there is 2 ways for GL to compute the reflected light.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.