Due to my experiences, you can use mtl_shaded and mtl_flat freely, they seem to be nothing special, just ordinary globally defined materials with a pre-assigned effect, probably a simple ffe.

You can create new custom material to test it, and utilize the 2nd uv set to get lightmap data to your shader (texture entSkin2;), as I have done it in MapBuilder with map-entities (by default they use mtl_mapent). In case of terrains no 2nd uv set is utilized, there you can access its LightMap bitmap (texture LightMap;).

I dealt with it a long time ago, but as I remember level blocks worked correctly with the same material+effect as map-entities (tested with a terrain and a prefab). Check "sc_obj_level_MB.fx", the corresponding lines are commented out, but search for "// lightmap usually looks bad with dynamic shadows", and you can uncomment all the relevant lines.

Moreover, to get correct lights probably you need to use VecLight instead of VecColor, which sums entity rgb colour (=VecColor) with prv colour (which strangely has no separate vector). It is a bit tricky to get similar light intensity as the engine default ffe produces...


Free world editor for 3D Gamestudio: MapBuilder Editor