• Advertisement

Archived

This topic is now archived and is closed to further replies.

Can't understand spot lights !!!!!!!

This topic is 5045 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, I''m new about direct3D programming, I have some questions about spot lights usage: 1) first of all: where can I find a complete documentation about lights usage ? 2) I created a 2d Wall, the vertices are placed along the z Axis: for example: -100, 100, 100 100, 100, 100 100, -100, 100 -100, -100, 100 the spot light is placed at 0, 0, 0 with orientation 0, 0, 1 and up normal 0, 1, 0, Umbra cone angle = .2 and penumbra cone angle = .4 My problem is that the 2d wall is not illuminated by the spot, but if I rotate the spot (same position) The wall is illuminated when the spot has strange and non realistic orientations. Where do I wrong ? Does someone have an example on using spot lights ???? I know that perhaps my post is too generic, but I''dont know which other informations to give to be more clear...

Share this post


Link to post
Share on other sites
Advertisement
As far as complete documentation on lighting, the DX SDK has a section on the different kinds of lights there are and how to use them.

The problem you''re seeing is that D3D calculates lighting at the vertices of each triangle. So if you have a big wall and point your light at the middle of the wall, then you may not even see the effects of the spot light because the light is calculated at each vertex of your wall and then interpolated across.

If this seems a little confusing, there is a sample in the DX SDK called LightVS. The sample uses vertex shaders to illustrate some lighting principles. I''m not telling you to go through the code and figure out how to use shaders (though it would be good for you to do in the future).

Just run the sample and play with the parameters it gives you. Specifically, change the type of light it uses to "spot light" and switch to wireframe mode. Then increase an decrease the number of triangles in the scene. You''ll see how the lighitng changes depending on how many triangles are in the scene.

neneboricua

Share this post


Link to post
Share on other sites
To provide a helpful answer.

I had the same problem. To Get effective lighting effects i''d say you need to use a mesh for the panel you have described. With a mesh that uses a vertex buffer u can simply calculate the coordinates of a panel.

I wrote an algroythm that filled a vertex buffer with panel vertices for any size panel and for any density of vertices.

I have found it really useful.

If you''re interested email me at ace_lovegrove@hotmail.com.

ace

Share this post


Link to post
Share on other sites
TANKS ALL FOR THE VERY HALPFUL REPLIES !!!!!

I feel I''ve found a very helpful and cooperative forum at all!!
Thanks again from a beginner :-)

Share this post


Link to post
Share on other sites

  • Advertisement