Hello Mauro,

Mauro Mithrandir wrote:
> I'm using a SimpleSceneManager (inside a QGLWidget) to manage a scene that 
> contains a transparent object. The problem is that I can't obtain a proper 
> rendering. I'm working on Linux with the latest OpenSG (rev. 2464).
> 
> I'm not so familiar with OpenSG 2.0. I remember that in the 1.8 release was 
> necessary to set ZWriteTrans and SortTrans to true inside the RenderAction.

sorting transparent objects is the default. ZWriteTrans is off by 
default, because sorting only happens at the object level not for 
individual triangles [1].
If part of an object is covered by another object the covered part 
completely disappears when writing to the depth buffer. If depth writes 
are off you still have a chance to obtain correct blending, but it 
depends on the drawing order, that's why by default depth writes are off 
for transparent objects.

> For setting ZWriteTrans and SortTrans I'm using this code:
> 
> ract = OSG::RenderAction::create();
> OSG::RenderOptionsRefPtr options = OSG::RenderOptions::create();    
> options->setZWriteTrans(true);
> options->setSortTrans(true);
> options->activate(ract);
> // ract->setZWriteTrans(true); (?)
> sceneManager->setAction(ract);

the RenderOptions are broken at the moment, but calling 
ract->setZWriteTrans() directly works since r2462.

> Then I've added a BlendChunk to the object's material:
> 
> OSG::BlendChunkRefPtr blendChunk = OSG::BlendChunk::create();
> blendChunk->setSrcFactor(GL_SRC_ALPHA);
> blendChunk->setDestFactor(GL_ONE_MINUS_SRC_ALPHA);
> chunkMaterial->addChunk(blendChunk);
> 
> But still transparency is not working properly. 

Can you upload a screenshot and post a link to it? It is often much 
easier to understand transparency problem when one can see what is going 
wrong ;)

        Cheers,
                Carsten

[1] Only sorting objects not triangles means there are limitations to 
how precise blending can be done.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to