How to read UV2?

I’m using this technique to build my levels: https://blender.stackexchange.com/questions/77264/how-can-i-bake-a-lightmap-and-use-it-in-blender-game-engine

Every object has it’s own UV, with it’s own texture, but I’m baking the lighting information for the whole level in their UV2. Each objects is it’s own .blend, and then I have a .blend for the entire level. It works well and I get really high-resolution shadows, which is awesome.

However, I can’t find a way to make Urho read my second UV and the lightmap texture. Is there a default shader that I can use, or I have to build one from scratch?

1 Like

Could this answer your question?

The problem is that this does not allow me to have normal materials for my other objects, like normal and specular.

It seems to me that DiffLightMap.xml + DiffNormalSpec.xml would make:

DiffNormalSpecLightMap.xml
<technique vs="LitSolid" ps="LitSolid" psdefines="DIFFMAP">
    <pass name="base" vsdefines="LIGHTMAP" psdefines="LIGHTMAP" />
    <pass name="litbase" vsdefines="NORMALMAP" psdefines="AMBIENT NORMALMAP SPECMAP" />
    <pass name="light" vsdefines="NORMALMAP" psdefines="NORMALMAP SPECMAP" depthtest="equal" depthwrite="false" blend="add" />
    <pass name="prepass" vsdefines="NORMALMAP" psdefines="PREPASS NORMALMAP SPECMAP" />
    <pass name="material" psdefines="MATERIAL SPECMAP" depthtest="equal" depthwrite="false" />
    <pass name="deferred" vsdefines="NORMALMAP" psdefines="DEFERRED NORMALMAP SPECMAP" />
    <pass name="depth" vs="Depth" ps="Depth" psexcludes="PACKEDNORMAL" />
    <pass name="shadow" vs="Shadow" ps="Shadow" psexcludes="PACKEDNORMAL" />
</technique>

Admitting I am no shader expert and did not test the resulting Technique.

Now I’m confused… so you can combine passes like that? The engine will just merge stuff? Where in the XML is it specifying to use UV2?

UV2 is reserved to be used with light maps, so that would be the LIGHTMAP part which tells the shader to add the lightmap to the final color:

I believe Techniques can also be constructed through code, I’ll have to browse source to tell you more.

1 Like
1 Like

Thanks for the info! Really useful.

1 Like

I’m glad to hear that. Did the DiffNormalSpecLightMap.xml solve your immediate issue?