How many types of Lightmaps are there to use & how to link them in Maya so that those LightMaps should come Properly in .Babylon or .gltf?

Need some help from experts.
I am basically working on an Architectural scene file trying to get realistic effect as much as possible. I am using Maya for modeling, texturing and Lighting. I am baking ambient occlusion ( using Render to Texture tool in Maya Arnold ) and linking the AO maps in Stingray material nodes ( which is PBR Material from Maya).
And getting couple of issues:

  1. How many different types of LightMaps to be used in babylon to get lighting effects? and how to generate them in Maya

  2. Where to link the LightMaps in Stingray (PBR) material node so that it comes properly in sandbox.babaylon

  3. Linking AO maps to one mesh is getting combined with roughness and metalic map when exported to GLTF / Babylon. Actually i was using tiling - U and V repetitions i.e, U scale, V Scale values to spread multiple tile effects on the floor / walls etc. how should i control AO and other texture values separately.

Let me add our in house awesome artist @PatrickRyan to the thread as he will have way more ideas than me about it :slight_smile:

@AD_Kar, let me answer your questions as best as I can while asking you a couple of clarifying questions. First, I am not sure if you are coming out of Maya to glTF or to a Babylon scene. Right now, there is nothing in the glTF 2.0 spec about light maps so exporting to glTF will not accommodate the light map. Historically, we used stingray materials as a way to export PBR textures to glTF, so we would not have added capacity to handle light maps due to the lack of support in the format.

@drigax and I chatted about this briefly and we will need to design the UX around how we export lightmaps using PBR materials because we will need to split the functionality between glTF and babylon formats. But for now, there are things you can do and I will talk about that in the answers to your questions:

  1. Light maps need to be saved into a separate UV set so that lights and shadow can be baked into an atlas. You can bake out lights to a texture or only shadow to the texture and control which type of map you are baking through this setting in the PBR material settings.. There are a few ways to bake out the map, but this is a simple on that does not require a specific renderer.
  2. There isn’t a place to link the light map to stingray, but you can add it in the sandbox. If you open your model in the sandbox, open the inspector in the bottom bar, and the select the material that should have the lightmap, you will see a channels section in the inspector. This is where you will add your lightmap by clicking on the Add Lightmap texture button. At the bottom of that section is the Use lightmap as shadowmap toggle to set the correct mode for the texture. You can then click on the Tools (wrench icon) tab at the top and save the scene as a babylon file which will include the lightmap as you set it up.

image

  1. For mixing tiling and AO you also need to use two UV sets. You’ll likely place your tiled UVs in the first set and the AO UVs as an atlas in the second UV set. This can become complicated if you also need a light map on your mesh as you can only have two UV sets. This could become an issue if you wanted to bake your shadows (and use the lightmap as a shadowmap) but still illuminate your mesh with scene lights and therefore need an AO map. You would need to make sure that the UV atlas in your second UV set works for both AO and lightmap which could mean you need to divide up your message in a specific way to work. Once you have the separate UV sets your AO/lightmap will bake correctly and you can still control the UV scale on all of your textures separately.

Let me know if you still have more questions about this. Take care!

2 Likes

Thank you for sharing this. Really helped me. I just have one question. How do you tell stingray PBS material to use an AO map in the second UV channel? Can you help me with this? I’m a Maya user and I have to use a blender just for the separate UV channel.

@Umer_Shafiq, I tend not to use Stingray since Maya stopped support for the shader a few versions ago. They have thrown their wight behind the Arnold shaders and have some newer PBR materials showing up in recent versions so we are working to support those shaders in our Babylon exporters. The way you would have set a connection to a second UV set was through the relationship editor which you can look at either through a Texture-Centric or UV-Centric view of your selected mesh. You would click the approporate texture/UV (depending on your selected view) in the left panel and then the corresponding UV/texture in the right panel to wire a connection to the correct UV set.

However, this does not seem to work for stingrayPBR anymore (which may be a side-effect of the deprecation of the shader) so it does not appear you can make that connection with this shader. I would move to the aiStandardSurface shader for Arnold, which is what we have been supporting to this point.

The other thing you can do if you want a quick fix if you are exporting to glTF is to quickly edit the texCoord value in the json of the glTF itself. You can open the glTF in something free like VSCode and search for your material name and then assign the correct UV set by changing the texCoord value:


glTF/gltfOverview-2.0.0b.png at main · KhronosGroup/glTF (github.com)

The mesh will tell you how many UV sets the mesh has and it will usually default to 0 (the first UV set) when it does not have any other information. However, changing this value to match the UV set you want at the material level will allow you to use any available UV set. This may not be the exact work around you were looking for, but it may be faster than opening your file in another DCC package to make a UV set assignment.