So psiberpunk - you were asking how normal mapping is supposed to work in an exporter. In maya, the first step is you just apply a normal map to the model. That’s just something you can do in Maya. The exporter detects if a normal map is applied to the model, and if so, it creates a texture entry that looks like this:
<Texture> my_normal_map {
layingrock-n.jpg
<Scalar> format { rgb }
<Scalar> wrapu { repeat }
<Scalar> wrapv { repeat }
<Scalar> minfilter { linear_mipmap_linear }
<Scalar> magfilter { linear }
<Scalar> envtype { normal } // LOOK HERE!!!
}
So it’s just like any other texture entry, except that it contains that line with the envtype normal.
Now, as for gloss maps: panda is using the convention that gloss values should be in an alpha-format texture, or packed into the alpha-channel of some other texture. A gloss map looks like this:
<Texture> my_gloss_map {
layingrock-g.jpg
<Scalar> format { alpha } // LOOK HERE!!!
<Scalar> wrapu { repeat }
<Scalar> wrapv { repeat }
<Scalar> minfilter { linear_mipmap_linear }
<Scalar> magfilter { linear }
<Scalar> envtype { gloss } // LOOK HERE!!!
}
It’s also possible to pack a standard color map and a gloss map together into a single texture - the color data in the (RGB) channels, and the gloss in the alpha channel:
<Texture> my_color_gloss_map {
layingrock.jpg
<Scalar> alpha-filename { layingrock-g.jpg } // LOOK HERE!!!
<Scalar> format { rgba } // LOOK HERE!!!
<Scalar> wrapu { repeat }
<Scalar> wrapv { repeat }
<Scalar> minfilter { linear_mipmap_linear }
<Scalar> magfilter { linear }
<Scalar> envtype { modulate_gloss } // LOOK HERE!!!
}
So to understand this, you first have to get over your preconception that ‘alpha’ means ‘opacity.’ Alpha can mean opacity, but it doesn’t have to. Alpha can be used for anything at all. In this case, we’re using alpha to indicate glossy regions of the texture. So we’ve created two JPGs, one color jpg (layingrock) and one black-and-white (layingrock-g). When panda loads it, it merges them into a single RGBA texture with layingrock-g in the alpha channel. The ‘envtype’ says that this RGBA texture is supposed to be used as a modulate_gloss map - ie, the RGB parts are supposed to be used to modulate the color value, and the A is supposed to control glossiness.
There are also glow maps (like gloss) and modulate_glow maps.