General Source query: How does dynamic model lighting work?

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,696
2,580
Since Source lighting is almost all pre-baked, how does it handle dynamic lighting cast by static light entities? Do they all double as cheap real-time lights for this purpose? Or is there maybe some kind of voxel-based system that stores prebaked light levels inside the playable space?
 
May 25, 2015
390
307
I'm pretty sure each model just samples the three/two closest light entities to calculate things like vertex lighting and phong highlights. Ambient lighting is stored in "ambient cubes" which are just points in space randomly placed within a vis leaf that stores ambient lighting from six different directions.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,696
2,580
"Randomly placed"? Surely it isn't totally random.
 
May 25, 2015
390
307
Last edited:

Pinsplash

bad bad bad
May 8, 2016
156
71
They are randomly placed. You can recompile a map and get slightly different lighting on dynamic objects.
 

fubarFX

The "raw" in "nodraw"
aa
Jun 1, 2009
1,720
1,978
They are randomly placed. You can recompile a map and get slightly different lighting on dynamic objects.
Really interesting if it's actually random.
Just out of curiosity, do you know when they are being placed? (vbsp, vvis, vard)
 

Pinsplash

bad bad bad
May 8, 2016
156
71
most likely vbsp. i remember there being a command to show them but i can't remember it
 

DrSquishy

we've all had better times to die
aa
Feb 10, 2017
1,300
974
mat_leafvis 1 and r_leafambient 1 should show ambient cubes iirc (when used together)
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,696
2,580
Man, I wish Valve was still submitting those SIGGRAPH papers. I don't think they've done one since Left 4 Dead 2.