Sign in to follow this  
bboysil

light map question

Recommended Posts

bboysil    108
I started studying the direct3d 9 API for more then 2 months and I have these questions about lightmaps: On MSDN library on the lightmaping with textures (http://msdn.microsoft.com/en-us/library/bb174695%28VS.85%29.aspx) section it says: "If you implement light mapping using multipass texture blending, your application should render the light map onto its primitives on the first pass. It should use a second pass to render the base texture. The exception to this is specular light mapping. In that case, render the base texture first; then add the light map." A code example is given here: http://msdn.microsoft.com/en-us/library/bb147400%28VS.85%29.aspx Can someone confirm my understandings: Lighmaps are usually used for lighting detail on static objects from static lights and are precomputed, right? I imagine you could do some sort of "dynamic" light mapping by calculating the lightmap in realtime and applying the lightmap to the objects but when you say lightmaping you usualy mean the static one, right? Assuming MSDN is talking about the first case, and knowing that the specular reflection takes into account not only the light direction but also the camera position, my question is: How is the specular highlight in the MSDN example working if the lightmap is precomputed? I mean if you move the camera you expect the specular highlight to move a little or the result will be unrealistic. Is there something I'm missing? Or is the MSDN article actually referring to a dynamic light map or maybe a static scene where the lights and camera don't move? [Edited by - bboysil on April 24, 2010 7:21:55 AM]

Share this post


Link to post
Share on other sites
bboysil    108
Someone pointed me to this page:

http://www.yaldex.com/game-programming/0131020099_ch17lev1sec2.html

And it clearly describes an example of static specular light mapping, maybe the guys on MSDN are referring to this particular scenario. I don't understand why they are talking about specular light mapping like it's applicable in general...


I also posted this question on xna.com under the direct3d9 forum and received some answers there

Share this post


Link to post
Share on other sites
Tom KQT    1704
The answer to your question is in the page from the link in your second post:

Specular lighting has a potential downside, though. Remember that the specular component is viewpoint dependent, so a viewer moving around an object should see the highlights move as well. Because we are limiting ourselves to static light mapping now, we cannot simulate this effect accurately. But imagine that the distance from the light to the lit wall is much smaller than the distance from the viewer to the wall. In this case, the dependency of specular highlights with regard to viewer movement would be very small, and therein lies the trick: Specular light mapping can accurately model highlights caused not by distant lamps illuminating highly reflective surfaces (think of a bright light and a metal ball), but by regular lights placed close to surfaces, thus producing the usual color burn. These highlights are almost viewpoint independent and look convincing when rendered with light maps.

Share this post


Link to post
Share on other sites

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