Jump to content
  • Advertisement
Sign in to follow this  
NekoCode

Normal map & Light map

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

Hey guys&girls, 

 

I am using q3bsp-styled world loading in my engine. While adding normal mapping I stuck in one question, how can I combine lightmaps and normal maps together to look good? Lightmap is just an image 512x512.

All normal maps basics says that you need LightDirection, but it's just an image. Who could help me?

 

Thanks in advance!

Edited by NekoCode

Share this post


Link to post
Share on other sites
Advertisement

You usually want the direction to come from the same as your global light, unless you want to get fancy and approximate bounce lighting by placing more lights in the scene.  As long as your direction is static (like, the sun, if you don't have day/night cycles), you can just write it right into the shader.

Share this post


Link to post
Share on other sites

With traditional light-mapping, you can't combine them with normal maps (unless like StarMire says above -- if your lightmap only contains direct sun lighting, you can use a fixed sun direction).

You need to re-create the light-maps again in a different form. This was a big advancement in Half-Life 2, which they called "radiosity normal mapping".

 

If you're using existing Q3 levels, with existing lightmaps, then you're out of luck.

Share this post


Link to post
Share on other sites

I got a new formula to make light map into the direction.

    float axisLight = dot( N, vec3(0.0, 0.0, 1.0) );
    vec3 final = decalMap.rgb * (lightMap.rgb * 2.0) * axisLight;

I will experiment with it and post what I'll get. And thanks for the link Hodgman! Useful information.

Edited by NekoCode

Share this post


Link to post
Share on other sites

btw bsp files come with entity data and its a simple text (like in map file - not compiled bsp) where light data is given - position, radius etc 

 

const int    kEntities = 0; // Stores player/object positions, etc...

if (Lumps[kEntities].Length > 0 ) {
Entities=new char[Lumps[kEntities].Length];

Edited by WiredCat

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!