I'm not looking at the hl1 code, but as I recall we didn't actually store any 
character lighting info in the maps (other than the world lights - used for 
direct lighting).  We just sampled the lightmap colors to generate it at 
runtime.  We did the same kind of thing in the first version of source 
(although there is a cache and an API to query it and the cache also stores the 
nearest world lights).  Later versions of source (Orange Box forward) store a 
set of cubemaps in the "LEAFAMBIENT" lumps in the BSP for the indirect 
lighting.  Vrad generates those and they are filtered to generate the 
directional ambient light per character/object.  That's why the ambient 
generally looks better in orange box and l4d.

So for goldsrc there may be a lightmap tracing function in the SDK interface 
(lightvec or similar name).  It would be the same as tracing a ray but you get 
the surface light color back as well as the normal you hit (and it's more 
expensive to compute because the intersection has to be clipped against the 
faces instead of just the bsp planes).  I don't remember if we exposed that 
through the SDK or if it's only used by the engine.  The other piece you'd need 
is to get the nearest world lights.  If that's not exposed you could replicate 
it by parsing the BSP and storing your own copy of them.

Jay

-----Original Message-----
From: hlcoders-boun...@list.valvesoftware.com 
[mailto:hlcoders-boun...@list.valvesoftware.com] On Behalf Of Tom Leighton
Sent: Wednesday, May 20, 2009 7:50 AM
To: Discussion of Half-Life Programming
Subject: Re: [hlcoders] Studio Light Data

This may be of use if you want to know where in the BSP it is stored,

http://www.geocities.com/cofrdrbob/bspformat.html

Tom

Andrew Lucas wrote:
> Hello.
>
>
>
> Lately, I've been experimenting with light calculations on my models, in 
> GoldSrc. I've been trying to get light values from the world myself, but I 
> have no idea how Half-Life stores it's light values, and gets them.
>
>
>
> For model rendering, Half-Life gets a color, an integer for shade lighting, 
> another for ambient lighting, and a light vector. I wonder, can anyone tell 
> me how this information is stored in the map?
>
>
>
> Thanks.
>
> Andrew.
>
> _________________________________________________________________
> Windows Live(tm): Keep your life in sync. Check it out!
> http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives, please 
> visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to