Sign in to follow this  

Light sources in Doom 3

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

Hello, Sorry if this has been asked and answered before, I have been searching and found many interesting threads, though none of them answers my question. In Hun Yen Kwoon's article "The Theory of Stencil Shadow Volumes", he says: "..., I estimate that id Software would have to limit the number of shadow casting lights in any scene to a maximum of say 4 or 5." , but that was like 2 years before the game was released. In our project in Computer Graphics at our university, me and my partner have developed our own engine, and we use shadow volumes. And even though it's a pretty inefficient implementation, we have studied it that much that we realize how high the fill rate really is, and how many passes it takes for every light you add. The question is, does somebody know for sure, or have a good guess on how many shadow casting lights there is in an arbitrary scene in Doom 3?

Share this post


Link to post
Share on other sites
I know nothing for sure, but since nobody else answered till now, I could say you my opinion: lights in doom 3 have a range, so the problem is how many lights affect with shadows an object at the same time. Well, I think they are not more than 2/3 at most. Nothing for sure, thought.

Share this post


Link to post
Share on other sites
Quote:
Original post by GMMigge
"..., I estimate that id Software would have to limit the number of shadow casting lights in any scene to a maximum of say 4 or 5."


[lol] These numbers are umm... a little off. The stencil shadow volume method can be limiting, however the Doom 3 engine is highly opimized and designed to be able to handle many lights simultaneously. While I can't go into concrete limits, I can say that the numbers stated in the afore mentioned article are not accurate.

Quote:
The question is, does somebody know for sure, or have a good guess on how many shadow casting lights there is in an arbitrary scene in Doom 3?


I personally don't believe that stencil shadow volumes are the best algorithm for shadow generation. I tend to prefer shadow mapping algorithms due mostly to their flexibility and their inherent nature to offload computation to the GPU. I would suggest opening the Doom 3 editor, making a simple scene, and benchmarking the results with multiple combinations of entities and lights. Remember that the cost of each light is dependant on the complexity of the geometry casting shadows. So try out different combinations with few entities and several lights and vica verca.

If I can be of further assistance please don't hesitate to ask.

Share this post


Link to post
Share on other sites
Also remember that static lights cost less than dynamic ones ( especially those that cast shadows ). Dynamic ones need to be relinked whenever they move. Additionally, if they cast shadows, the silhouette needs to be determined again, the actual volume has to be created etc.. So thats quite expensive! Thats why D3 has shadows turned of for many dynamic lights where you dont instantly note the effect

Share this post


Link to post
Share on other sites
Quote:
Original post by Sages

I personally don't believe that stencil shadow volumes are the best algorithm for shadow generation. I tend to prefer shadow mapping algorithms due mostly to their flexibility and their inherent nature to offload computation to the GPU. I would suggest opening the Doom 3 editor, making a simple scene, and benchmarking the results with multiple combinations of entities and lights. Remember that the cost of each light is dependant on the complexity of the geometry casting shadows. So try out different combinations with few entities and several lights and vica verca.

If I can be of further assistance please don't hesitate to ask.


I agree with you, but keep in mind that designing a very accurate shadow map engine is no so easy...But shadow mappin also for me is the best!

Bye Davide

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If you go into Doom 3 and type 'r_showlightcount 1' in the console, it will color code each of the faces (or brushes, in this case) with how many lights are effecting it. Black = 0, red = 1, green = 2, dark blue = 3, light blue = 4, pink = 5 and white = 6+. It's reccomended that you keep the lights per-brush to 4 or less, though the occasional 5 or 6 are acceptable. I beleive that theres really no hard coded limit on the number of lights you can have effecting one face, but the more lights there is the more passes it takes and the more your framerate bites the dust.

The important thing to realize here is that this is the amount of lights PER-BRUSH, not per-scene. A scene can have 10-20 lights in it and run fine as long as those lights don't overlap too much.

Share this post


Link to post
Share on other sites
Thanks for the replies.

That was a great tip Blue*Omega, very interesting to see the results of that.

I'm still quite impressed by the Doom 3 engine, not comparing it with others, but just after implementing our own engine with simple shadow volume support and knowing the work behind all of it. Easy in theory perhaps, but quite a lot of work in practise.

Share this post


Link to post
Share on other sites
Quote:
Original post by Blue*Omega
The important thing to realize here is that this is the amount of lights PER-BRUSH, not per-scene. A scene can have 10-20 lights in it and run fine as long as those lights don't overlap too much.


Well said. But you can have well over 10-20 lights in a given view, as long as the amount of geometry interaction with that light is kept to minimal ammount. 50 small lights touching 1/50th of the level each would be better than 5 huge lights that span the size of your scene. It's not about quantity so much as it is complexity. Just use your best judgement and use the CVar that Blue*Omega mentioned as well as the many others ( ["r_" + tab] is your friend ) that are provided to you. Good luck.

Share this post


Link to post
Share on other sites
you might want to check out nVidia's UltraShadow II technology (which seems designed purely for doom 3 [wink]). You basically set the near and far rendering planes to the closest and furthest distance the light can affect and then do the stencil passes. It cuts down a load of work as pixels outside the drawing range are discarded immediatly.

Share this post


Link to post
Share on other sites

This topic is 4713 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this