Transparency does not work with other than egg or bam formats

Hello to the community once more!

I am facing the following problem with transparency. when my objects are loaded from egg files, transparency works well as shown in the following picture

when i convert the eggs to bam using the egg2bam.exe it works as well.

the problem is that my original objects are neither egg or bam but fbx or obj so i need to perform a convertion that takes time. when i load the obj or fbx directly into panda3d, transparency no longer works:

the loader part of my code is:

    obj_file = Filename.fromOsSpecific(obj_file)  # convert path to pandas3d format
    mesh = loader.loadModel(obj_file)  # load the egg into memory
    mesh.setTwoSided(True)  # set rendering of both sides
    mesh.setCollideMask(BitMask32.bit(1))  # Set the model to be collideable with the ray.
    mesh.setTag('part', str(pid))  # so we can look up which piece this is later during the collision pass
    mesh.flattenStrong()  # simplifies the node so it renders quicker
    mesh.setTransparency(TransparencyAttrib.MAlpha)  # enable transparency change in that node

and finally, when i want to make an object transparent i use:

    mesh.setBin('fixed', 0)

anyone has an idea on how to achieve the desired result without having to use the egg or bam format?

Are you using the shader generator?

Can you give the output of calling .ls() after loading the model from both .obj and .egg?

i never created shaders but i am not sure if something is done by default

here is what you need:

PandaNode vehicle T:(pos 0 -9509.36 0 hpr 9 56 43)
ModelRoot 15202411.egg [part] S:(TransparencyAttrib)
GeomNode root (2 geoms: S:(CullFaceAttrib))

PandaNode vehicle T:(pos 0 -9509.36 0 hpr 9 56 43)
ModelRoot 15202411.obj [part] S:(TransparencyAttrib)
GeomNode 15202411.obj (1 geoms: S:(CullFaceAttrib MaterialAttrib))

there are two differences:

  1. egg sees 2 geoms while obj only one
  2. obj has the MaterialAttrib

OK, maybe the MaterialAttrib is the difference. Try disabling the material, using something like this:

1 Like

yes! that it.

many thanks