ericwa/ericw-tools

Make surface lights play better with real time light renderers

dsvensson opened this issue · 3 comments

When playing around with real time light preview it became apparent that it would be very nice to be able to filter out the generated surface light entries. In my usecase I will read the ents from the .map, but if someone would want to make a real client with realtime lighting some day that problem will arise.

So I'm thinking that the original light that has the _surface* flags could be turned into for example info_null, which wouldn't cause any warnings anywhere, possibly be assigned some _surface_light_id: xxx, and all the lights generated could get that same _surface_light_id: xxx. That way it's easy to configure the material to for example emit the correct color.

Paril commented

Light templates aren't removed so that they can be re-passed through light for future compilations. I don't know if there's a good solution for this - it's already kind of accepted that light entities are not suitable for real time playback (see rtlights for Darkplaces, etc) so I don't know if this is something we should try to address.

If it's solely for your own projects, you could do a post-processing pass of just removing any light entities with templated keys.

ericwa commented

Also, the generated lights are never written to the bsp. So, for surface lights, it's just the surface light templates that will be in the bsp entities lump. As Paril said, we'd like to keep the bsp entities lump as close as possible to what was in the map file, for decompilation reasons. We do tweak some things in entities.cc:LoadEntities but that's mostly for making lightstyles work.