Archived

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

Terrain Lighting?

This topic is 5619 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

What would be the best way to do shadows in a terrain engine? I have tried using Directx lighting, but that didn''t cut it.. I wrote a simple vertex lighting thing, but my shadows look blocky. Is there a better way to do lighting than this?? Thanks.

Share this post


Link to post
Share on other sites
Read thorugh this tutorial twice:
http://www.gamedev.net/reference/programming/features/shadows/page4.asp

Now rip the ShadowVolume class from the directx sdk stencilbuffer->shadowvolume sample.

I just did it, and it looks great when my spaceship flies over my generated terrain

.Pangis

Share this post


Link to post
Share on other sites
Well, shadow mapping doesn''t allow for realtime effects. I am looking for something I can alter in realtime without much fuss and computational expense. The Directx lighting I was using, used normals to compute the ligting, it wasn''t true lighting, it didn''t cast shadows, it just shadded polygons that faced away from the light source, this isn''t what Im looking for. Would stencil buffers work, I haven''t read to much into stencil buffers, but I know they can be used for shadows. Would this be a fast realively fast approach or not? If so, do you know of any good tutorials on how to use stencil buffers for shadowing? If you could help I would really appreciate it..

Thanks in advance.

Later,
James

Share this post


Link to post
Share on other sites
Read these great articles on Gamasutra. One explains stencil buffers, and the other explains the use of shadow volumes to create realtime shadows.

http://www.gamasutra.com/features/19991115/bestimt_freitag_01.htm
http://www.gamasutra.com/features/20000807/kovach_01.htm

After you''ve read them, study the SDK tutorial on shadow volumes. (Source: (SDK root) \Samples\Multimedia\Direct3D\StencilBuffer\ShadowVolume)

In answer to your question about speed, that depends on your implementation. The first thing you''ll notice when you filch the SDK sample''s code for your own project is how slow it runs. This is because the sample is creating/deleting heap memory every frame of animation, and also locking/unlocking the vertex buffer once per object.

With a little creativity you can speed shadowing of this type up quite a bit. I''m using shadow volumes for my demo, and it hauls pretty well.

Ganbatte kudasai (good luck).
--Hoozit.

Share this post


Link to post
Share on other sites