PBR and the name of texture maps

Trying to customize the PBR rendered, I came to the conclusion that use naming texture aliases is not a bad idea. However, at the moment this is implemented through names with texture modes. Which leads to ambiguity.

At the moment, the classic PBR consists of such a set of texture maps.

  • albedo
  • normal
  • metallic
  • roughness
  • ao

However, panda offers not quite suitable names.
https://docs.panda3d.org/1.10/python/reference/panda3d.core.TextureStage#_CPPv44Mode

I have a question is there any way to replace this with a name TextureStage('albedo') Accordingly, in the shader it would look like this: uniform sampler2D albedo or uniform sampler2D p3d_albedo

There are predefined texture input names intended for PBR texture maps:

https://docs.panda3d.org/1.10/python/programming/shaders/list-of-glsl-inputs

There are a few undocumented, this is the full list:

uniform sampler2D p3d_TextureFF[];
uniform sampler2D p3d_TextureModulate[]; // default color: (1, 1, 1, 1)
uniform sampler2D p3d_TextureAdd[];      // default color: (0, 0, 0, 1)
uniform sampler2D p3d_TextureNormal[];   // default color: (0.5, 0.5, 1, 0)
uniform sampler2D p3d_TextureHeight[];   // default color: (0.5, 0.5, 1, 0)
uniform sampler2D p3d_TextureGloss[];    // default color: (1, 1, 1, 1)
uniform sampler2D p3d_TextureSelector[];
uniform sampler2D p3d_TextureEmission[];

The “selector” slot is intended for an AO, metallic, roughness map. This has the AO in the red channel, the roughness in the green channel, metallic in the blue channel, just like in glTF 2.0, and panda3d-gltf uses this slot for that purpose. This slot will be renamed accordingly in 1.11.

1 Like

Yes, I’m already using it. However, there is a problem with matching names, panda suggests names that do not match the name of the maps, except for the normal map. However, this is not a problem, the problem arises when you create a scene programmatically and configure the shader outputs. The glTF 2.0 standard implies that you got your texture maps from a 3d editor. But on the Internet, as a rule, such texture maps are spread out:

  • albedo
  • normal
  • metallic
  • roughness
  • ao

In this case, it is additionally required to merge them into RGB. And user needs to do it manually, which is frustrating.

Ah, I think I didn’t prepare the texture correctly. I suppose the simplepbr shader will mix the data from the channels into one texture by itself.