Jump to content
  • Advertisement

Archived

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

Delta69

Day/Night Light Maps. Ie How to light windows at night???

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

How do you do light maps like the following pictures? The windows are still fully lit at night even though it appears the ambient and diffuse light levels have dropped... Ive played around with texture blending and can not seem to reproduce the effect. My guess is the light map should not be effected by diffuse and ambient lighting ( as the light levels change from Day to Night levels) but I can not seem to figure out how to make that so. Can anyone help?

Share this post


Link to post
Share on other sites
Advertisement
- what if the windows are separate objects/meshes which don''t have the lightmap applied...

- what if the lightmap simply has holes cut out for the windows which are pure white or pure black (depending on whether you use darkmapping or lightmapping). I suspect what you''re talking about is modulative blending so really its darkmapping. (The shots look like dark mapping too - i.e. start with a fully bright object and add patches of darkness)...


There''s plenty of ways to achieve the above - how do you know they''re even dark mapped at all ?

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Simon,

So what you are describing is dynamic lightmapping/darkmapping correct? "i.e. start with a fully bright object and add patches of darkness"

Even doing it by adding patches of darkness, where do you place the dark patches??? I guess I could use multiple static light maps for the current time of day. But I would prefer a more dynamic codable approach.

So would the following work by using three texture stages instead of two, and it would get rid of the problem of knowing where to add the dark patches like you said (If it would work that is?)
1) Have the base texture as Texture Stage 1
2) Have a "dynamic" blank texture for Texture Stage 2. The texture will be entirely white for High Noon, entirely black( or more exactly low level grey) for Midnight, and shades of grey for all other times. It is a dynamic map as its white/black color level would be dependent upon the time of day and set by a time function much like I did in the code below.
3) Have a "static" darkmapped texture for stage 3. This texture has the dark holes, and white areas are over such things like windows, lit signs, etc.
4) Render



BTW in my engine I set ambient light levels based upon a sigmoid function for day/night transitions at dusk and dawn.

The ambient light levels darken everything at Night, including the areas that are lightmapped with white that I want to stay bright. This is the problem Im having and should have been more specific of in my original post. So it looks like I have to scrap this when lighting my terrain and structures.... (sigh!) Here was my original ambient lighting code:


            
if ( ( m_fHour >= 4.5f && m_fHour <= 7.5f ) || ( m_fHour >= 16.5f && m_fHour <= 19.5f ) )
{
float angle;
float sigmoidRed;
float sigmoidGreenBlue;

if ( m_fHour > 16.5f )
angle = -1.0f * m_fSunAngle + D3DX_PI / 2.0f; // Day to night, dusk

else
angle = m_fSunAngle - 1.5f * D3DX_PI; // Night to Day, dawn



sigmoidRed = 1.0f / ( 1.0f + exp( -60.0f * ( angle + D3DX_PI/10.0f ) ) );
sigmoidGreenBlue = 1.0f / ( 1.0f + exp( -60.0f * ( angle - D3DX_PI/10.0f ) ) );


redChannel = 255.0f * ( m_cNightAmbientColor.r + ( m_cDayAmbientColor.r - m_cNightAmbientColor.r ) * sigmoidRed );
greenChannel = 255.0f * ( m_cNightAmbientColor.g + ( m_cDayAmbientColor.g - m_cNightAmbientColor.g ) * sigmoidGreenBlue );
blueChannel = 255.0f * ( m_cNightAmbientColor.b + ( m_cDayAmbientColor.b - m_cNightAmbientColor.b ) * sigmoidGreenBlue );

m_pD3DDevice->SetRenderState( D3DRS_AMBIENT, D3DCOLOR_RGBA( redChannel, greenChannel, blueChannel, 255 ) );
}


[edited by - Delta69 on January 31, 2003 12:59:09 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by S1CA
There''s plenty of ways to achieve the above - how do you know they''re even dark mapped at all ?



Oops forgot to reply to this part. Im not sure really if they are. But they look like they are to me. Is there a better way to do like what the pictures show besides light/dark mapping???

BTW Im confused on what is the difference on light and dark mapping. Im not too keen on the names for these techniques.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!