View unanswered posts | View active topics It is currently Sat Oct 23, 2021 7:50 am



Reply to topic  [ 3 posts ] 
 How to set opacity on a mesh? 
Author Message

Joined: Wed May 22, 2013 5:25 pm
Posts: 12
Post How to set opacity on a mesh?
Hi Laurent,

I've been trying to dynamically change opacity/transparency values of some meshes in the world (via a slider). Calling setRenderProperties on GLC_StructOccurence with
Code:
qreal opacity = 0.5;
GLC_RenderProperties properties;
properties.setOverwriteTransparency(opacity);

does not work. At the end I resorted to directly retrieving GLC_Mesh * instances from
Code:
occurrence->structInstance()->structReference()->representationHandle() 

so that I can finally do this
Code:
for each (GLC_Material * mat in glcMesh->materialSet())
mat->setOpacity(opacity);

which I'm sure is not the intended way. Is there a better approach to achieve this? Also, changing the opacity on all of the meshes in the scene suffers from the Z-sorting issue. Any suggested workaround?

Many thanks,
Jozef


Last edited by jozefdobos on Fri Sep 20, 2013 8:43 am, edited 1 time in total.



Thu Sep 19, 2013 10:50 pm
Profile
Site Admin

Joined: Sun Jan 03, 2010 4:27 pm
Posts: 390
Post Re: How to set opacity on a mesh?
Hi Jozef,
jozefdobos wrote:
I've been trying to dynamically change opacity/transparency values of some meshes in the world (via a slider). Calling setRenderProperties on GLC_StructOccurence with
Code:
qreal opacity = 0.5;
GLC_RenderProperties properties;
properties->setOverwriteTransparency(opacity);

does not work. At the end I resorted to directly retrieving GLC_Mesh * instances from

It's the right way to dynamically change opacity/transparency but you forgot to set rendering mode :
Code:
GLC_RenderProperties properties;
properties->setOverwriteTransparency(opacity);
properties->setRenderingMode(glc::OverwriteTransparency );


@+


Fri Sep 20, 2013 7:41 am
Profile

Joined: Wed May 22, 2013 5:25 pm
Posts: 12
Post Re: How to set opacity on a mesh?
Great, this helped, many thanks!

I assume the order-independent transparency is still an issue. Something like depth peeling might be reasonable:
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.18.9286&rep=rep1&type=pdf
http://developer.download.nvidia.com/SDK/10/opengl/src/dual_depth_peeling/doc/DualDepthPeeling.pdf


Fri Sep 20, 2013 8:49 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.