Leadwerks engine portal system

Miscellaneous Forums/Blitz Showcase/Leadwerks engine portal system

It seems that the longest step when loading is processing lights on all models the first time. This takes more than one minute on my machine.

The engine lights models a bit differently than the editor. In the editor, I calculated lighting for each vertex. In the engine I am just doing a single visibility check between the center of the model and the light position, and using hardware lights on the entire model. This gives slightly less accurate lighting than coloring each vertex, but the upside is that static and dyanmic lighting are just the same, for models. It also means that the mesh color array can be used for bumpmaps. HL2 uses this same exact method. You'll notice their models are either lit completely by any given light, or are unaffected.

A good solution would be for the engine to process the lighting once, then save the results to a file that goes along with the .3dw file. You will only have to do the slow light processing once any time you change the map. After that, the editor will detect and load the associated light info file.