Light Maps

Tutorial collection, comprehensive listings on main site.

Light Maps

Postby Tutorial on Wed Mar 16, 2005 12:45 am

category
General Half-Life 2/Lighting

description
Increase the quality of your shadows using Light Maps.

keywords
light, maps, map, lights.

An introduction to lightmaps

Basically in source lightmaps control how detailed your shadows are, this short tutorial will just give you a quick explination as to how to change the lightmap scale

To change the lightmap scale you select the face of a brush with the face selector and you can see the lightmap box to the right of the texture shift tab.

In source a face usually defaults to a lightmap scale of 16, which is, to be honest, pretty poor, so to change the lightmap scale just use a different number, note that you can only use powers of 2, so thats 2, 4, 8, 16, 32 etc. if you dont you will get an error message when you try and play the compiled map.

You can check your lightmap grid in the 3d view, this just gives you a look at your lightmaps on your faces, for example in this picture the left grid has a lightmap scale of 32 (euch) and the right has a scale of 2...

Image

so basically on the left half of the wall the shadows would look horrible and nasty, whilst on the right they would be very fine and precise

but heed warning, lowering lightmaps increases vrad times ALOT so its only best to play with lightmaps for the final compile of a map. on the same note you can increase lightmap scales to make vrad take less time, but of course, the shadows would look worse.

Ta for reading
-Wiggle987
- Don't send PM's to this user -
Tutorial
Not A Real User
 
Joined: Sun Mar 06, 2005 11:00 pm

Postby zombie@computer on Wed Mar 16, 2005 2:22 pm

Um, i would like to add something mentioned on verc:

a phenomenon called lightbleeding, and it works like this:

during compile, rad lights each lightmap as one color, then bounces the light around (because every non-black surface bounces light) and then fades the lightmaps into each other to create the final lighting

take this example:

Image
IF the selected brush is a world brush, the wall in the back would be clipped to size and nothing would be wrong when lighting the map. If you only place a light at one side of the selected wall the other would stay dark
Image
however, when you make it a func_detail, this clipping does not occur. Allthough func_detail block lights, light can actually hitchhike from one side to the other using the lightmaps that span accross the func_detail:
Image
When rad lights your map, the red-lined lightmaps will be considered lit by the light on the left. but, since the entire lightmap is lit as one, the part of teh lightmap on the other side of the func_detail will also be lit!
because rad also bounces the light around and fades it into other lightmaps, it will look like the light shines through the func_detail, but infact its shining around it. to prevent it, you can clip the walls so the lightmap doesnt exist on both sides of the func_detail or you can move the func_detail so it matches the lightmap grid (so no lightmap crosses the side of the func_detail:
Image
both of these walls(func_detail) are able to stop the light completely (from left to right and vice versa) because:
-the left wall has no lightmap that crosses to both sides
-the right wall (after being clipped at the white line) also hasnt got one lightmap (allthough they still appear to be one, they are on different faces thus different lightmaps!)
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Postby Jaytheham on Thu Mar 17, 2005 8:12 pm

Also, I feel I should point out that unless it is vitally important that your map have high quality shadows, you shouldn't increase the quality of them at all. Or only increase a few faces which have important shadows being cast on them, here's why:

As you can tell from the shadows, the left side of the room is better, lightmap scale of 2. The right side has the default scale of 16.
Image

But if you look at this with wireframe on, you'll see that the increased quality lightmap also comes with 8x as many polygons.
Image
Jaytheham
Just Joined
Just Joined
 
Joined: Thu Mar 17, 2005 7:59 pm

Postby Blink on Thu Mar 17, 2005 8:20 pm

Higher poly counts are expected to be honest, as you said, use it on faces that are important.
User avatar
Blink
Cool 'n that
Cool 'n that
 
Joined: Fri Oct 08, 2004 4:16 pm
Location: UK

Postby Cactusman on Tue Mar 22, 2005 1:06 pm

The only thing that seems to stop a dynamic light from bleeding through things is a brush with the block light texture on it.
Cactusman
Dumpling
Dumpling
 
Joined: Tue Mar 22, 2005 12:57 pm

Postby TorQueMoD on Sun Nov 20, 2005 8:55 pm

Personally I think the shadow with the lightmap scale of 16 looks better than the one with a 2. The one with a 2 is too crisp and sharp at the edges. The only way you'd get a shadow that's so crisp is if the object is very close to the wall, or your light source is incredibly bright. Since this is not the case in the picture above, the lightmap scale of 16 actually looks more realistic since its edges are faded.
-TorQue[MoD]
Environment and Game designer
http://www.torquemod.com
User avatar
TorQueMoD
Been Here A While
Been Here A While
 
Joined: Wed Oct 19, 2005 7:15 am
Location: Vancouver, Canada

Postby Blink on Sun Nov 20, 2005 9:51 pm

There are options for lightmap 6, 8, 12 etc, which look far better then 16. The above image was a poly example.

If you want light cast through support beams for example and you want the shadows from this to show up, lightmap 16 is often to high for this to happen.
User avatar
Blink
Cool 'n that
Cool 'n that
 
Joined: Fri Oct 08, 2004 4:16 pm
Location: UK

Postby mike-o on Mon Nov 21, 2005 1:44 am

will someone explain to me why lowering lightmap scale bumps up poly count? i thought the resource hogger in lowering lightmaps would be a boosted texture memory.
User avatar
mike-o
Sir Post-a-lot
Sir Post-a-lot
 
Joined: Tue Feb 01, 2005 12:18 am

Postby Uragan_Lex on Fri May 12, 2006 4:11 pm

zombie@computer - yours images don't shows. If it not problem for you - can you refresh links?
User avatar
Uragan_Lex
Just Joined
Just Joined
 
Joined: Fri May 12, 2006 4:03 pm

Postby The Watcher on Fri May 12, 2006 8:26 pm

Uragan_Lex wrote:zombie@computer - yours images don't shows. If it not problem for you - can you refresh links?


Uh, hi. What a wierd avatar you have. Did you join just to say that?
The one and only anti-Interloper

This forum is an evil negativity-brewing hellhole, like all internet communities, and should be shut down...
The Watcher
Banned
 
Joined: Sat Jul 16, 2005 8:13 pm
Location: Destroying evil forums like this one

Re: Light Maps

Postby TicTac on Thu Nov 27, 2008 2:18 am

Just thought I'd say, lightmaps work with non-poweroftwo numbers, ie 10, 3, 9. In fact, displacements will default to 9 if their lightmaps are set higher than that.
User avatar
TicTac
Veteran
Veteran
 
Joined: Sat Aug 02, 2008 1:30 am
Location: Philadelphia

Re: Light Maps

Postby 904 on Thu Nov 27, 2008 8:29 am

They might work, but they won't line up..
904
Design Section Moderator
 
Joined: Tue Aug 30, 2005 9:26 pm
Location: Gitmo-nation Lowlands

Re: Light Maps

Postby butter_biscut on Thu Jan 21, 2010 7:11 pm

does this error have anything to do with this topic? [MaterialSystem_Interface_t::AllocateLightmap: lightmap (516x13) too big to fit in page (512x256).]
butter_biscut
Member
Member
 
Joined: Mon Aug 11, 2008 7:10 am
Location: Nevada, area51

Re: Light Maps

Postby TorQueMoD on Wed May 05, 2010 5:03 pm

@ butter_biscut - most likely. Always use a power of 2, it just works out better.

@ Mike-0 - its because of the way Hammer chops up the geometry when the map is compiled. Its not just scaling the texture, its actually increasing the number of divisions of the face of the wall(s).
-TorQue[MoD]
Environment and Game designer
http://www.torquemod.com
User avatar
TorQueMoD
Been Here A While
Been Here A While
 
Joined: Wed Oct 19, 2005 7:15 am
Location: Vancouver, Canada

Return to Tutorials

Who is online

Users browsing this forum: No registered users