mutlisample and transparency issues

Hello,

I have been playing around with Panda for few weeks in order to develop a small application that displays several semi-transparent models which overlap. Of course, I’m confroted by some issues of transparency and rendering order …
I’ve read the manual and I would like to use MMultisample mode.
Unfortunately, it reacts like the binary mode whereas my graphics card (a quadro 5000) should have no trouble to support it.

Here is a little script that works exactly like my application :

from pandac.PandaModules import *
loadPrcFileData("","framebuffer-multisample 1")
loadPrcFileData("","multisamples 32")
#loadPrcFileData("","notify-level-display debug")

from direct.directbase import DirectStart
from direct.gui.DirectGui import *


print base.win.getFbProperties()
# depth_bits=24 color_bits=24 alpha_bits=8 accum_bits=64 multisamples=32 back_buffers=1 force_hardware=1 force_software=1



smiley = loader.loadModel("/usr/share/panda3d/models/smiley.egg.pz")
smiley.reparentTo(render)
smiley.setPos(-0.2, 10, 0)
smiley.setTransparency(TransparencyAttrib.MMultisample)

frowney = loader.loadModel("/usr/share/panda3d/models/frowney.egg.pz")
frowney.reparentTo(render)
frowney.setPos(0.2, 10, 0)
frowney.setTransparency(TransparencyAttrib.MMultisample)

def setOpacSmil():
    smiley.setAlphaScale(sliderSmil['value'])

def setOpacFrow():
    frowney.setAlphaScale(sliderFrow['value'])
 
sliderSmil = DirectSlider(value=0.5, pageSize=3, command=setOpacSmil)
sliderFrow = DirectSlider(value=0.5, pageSize=3, command=setOpacFrow)

sliderSmil.setPos(0, 10, -0.75)
sliderFrow.setPos(0, 10, -0.9)
run()

I would like to know if I’m doing something wrong or if it comes from my configuration.
And by the way, I would also like to know if someone could send me a little script using antialising with multisampling that I can test on my machine to be sure that there is no problem with my graphics card.

Many thanks in advance.

tite-egna

Hello!
First, I apologize for the double post…
In the case the multisampling could not solve my problem, I tried to find an alternative solution. I tried all the methods suggested in the manual without any success (but maybe I did it wrong :X) and now I finally ask for your help again.

Here is exactly my problem:
I’m working on an application for easily viewing and manipulating medical data for inexperienced people. The goal is to be able to rotate and change opacity of 3D models of organs in order to understand their structure and layout.

The problem is that they are all contained inside each other and therefore overlap.
Example with a brain

Here, there are two visible models: a colored one and a white one. The white model is included in the colored one except on the red part where they overlap.
Levels of transparency are the same in the two screenshots (the blue and red model is semi-transparent while the white matter is completely opaque) and only the orientation changes slightly. We can see that depending on the orientation, we see or not the underlying model.
I tried to change the rendering order but since the levels of transparency change and models overlap, I can not find the right parameters to provide an acceptable render… In addition, I made the application so that the provided model can be change easily. Thus, I cannot set a static order.

I would like to know if someone could help me and put me on the right path to find a solution…

And by the way, beside this I have small glitches that appears sometimes when the models are semi-transparent… I don’t know if it’s related but in case of someone know a solution to remove them, I would gladely try it !

I don’t know how good multisample transparency is. My hardware don’t support it. With my experience with transparency I was most successful with MDual, sometimes I needed to put some models in an unsorted bin (my_model.setBin(“unsorted”, 2)), but still artefacts crop up from time to time. If there’s not much zooming in your program you could try setting some depth offsets.

I somehow feel that You’d benefit from a custom transparency mixer, like rendering parts in offscreen buffers and then mixing it with a shader, but that’s beyond anything I can do.

Hello,
Thank you for your quick answer.
Meanwhile, I tried to use the multisampling on Windows and this time, it worked!
It seems like something is missing on Ubuntu to activate it…
Unfortunately, my application is meant to be used on Linux as well as windows so I keep looking for a solution.
Changing the render order with an unsorted bin and using the Mdual mode doesn’t give good result but I’m going to test your other suggestion. I’ll keep you informed of the results if I can figure out how to implement it.

Have a good day and thanks again!