PDA

View Full Version : Light shapes



vmh4
09-23-2002, 07:20 AM
Is there an easy way to have say an elliptical spot light? I.e. I'd like to apply something like a non uniform scale to the light. Thanks for any help.

SirKnight
09-23-2002, 07:44 AM
You could use a cubemap. On one of the cubemap faces have your ellipse image, going from black in the center to white on the edges. Then using either a vertex program or the texture matrix, rotate the cubemap so that this ellipse is facing in the direction of the light. A good source to look at would be Ron Frazier's advanced perpixel lighting demo. It's on nvidia's dev site.

-SirKnight

ToolTech
09-23-2002, 07:49 AM
You can use shadow volumes and reverse the effect of the lamp and use it as a spot volume instead. This way you can easily set up the shape of your lamp.

zed
09-23-2002, 12:59 PM
u could use a projected texture, see the redbook/glut for examples

jwatte
09-24-2002, 07:06 PM
Shadow volumes won't work because they don't have diffuse edges.

Cube maps won't work, either in NORMAL_MAP mode or REFLECTION_MAP mode, because they don't properly factor in the locality of a spot light.

Projected texturing is the correct solution, although you probably want to somehow make sure you don't draw it on triangles that face away from the light -- a projected texture coupled with a shadow volume or depth shadow map would be the "ideal" solution.