Panda3d Materials

While practicing with shaders, I realized that in order to avoid problems when using the alpha channel and mip mapping, duffuse and alpha channels should be separated. To be able to configure filtering separately for the texture and its alpha component. Here is an example on the left the alpha channel is filtered, but on the right it is not.

However, there is one problem, the standard shader generator treats the texture as a whole. To implement this, you need to write your own shader, as in my example.

I think the shader generator is very outdated, and there are also problems with the names of inputs for textures in the shader.

For example, from this list it is not clear through which name you can pass a texture with alpha components.

The only option is via the method, set_shader_input().

self.render.set_shader_input("opacityMap", opacityMap)

What can become very cumbersome over time is also not clear how to export it from a 3D editor. The only way out is to configure everything manually, since there are usually not so many objects with transparency. But in any case, you need to write custom shaders. It’s also possible that I hurried to make a problem out of this, since Panda3D may have some kind of hack in order not to filter the channel with alpha. Maybe someone knows how to get around it.

I also remembered that the shader generator somehow affects transparency, perhaps adds some noise, I definitely did not investigate this. That’s what I’m facing here:

When calculating the illumination.

1 Like