PDA

View Full Version : spotlight on textures!!!



Hassan
04-09-2004, 04:16 AM
hi guys..
i found out that in order for the spotlight to appear on a surface, the surface must have vertices in it.. I mean, if you target a spotlight on a huge quad, and the spotlight cutoff angle does not contain the corner vertices, no light is seen. I resolved this problem by making my quad (wall) into a grid. light can now be seen on the wall. now i am trying to put the spotlight on a texture which is obviously defines as a quad. i dont see light on it (ofcourse i'm using modulation). i think that if i split my texture into a grid as well, it might work but its a huge fuss making a grid out of the texture and apply it in the correct place. (dont want to tile the texture. it should appear as the entire bitmap only once). is there any better way??

Deiussum
04-09-2004, 04:28 AM
As you noted, OpenGL lighting works on a per-vertex basis. There are various techniques you can use to do your own lighting, like using lightmaps.

For your textured quad, if you want to use OpenGL lighting, break it up like you said, and for the texcoords of the inner vertices, just use values between 0 and 1, depending on how close to the edge of the main quad it is.

For instance, the vertex in the middle of your quad would have a texcoord of 0.5, 0.5.