Plotting order of the half-transparent objects

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Plotting order of the half-transparent objects

Sergey
This post was updated on .
Hi All,

Suppose one have such code that plots 3 spheres one in another with different Alpha channel values. Everything works fine when first we plot the small object, then middle (that contains small) and then the biggest (that contains small and middle).

        small = (env.plot3(points=np.array(((-0.5,0.5,0))),
                                   pointsize=0.1,
                                   colors=np.array(((0,0,0,0.9))),
                                   drawstyle=1))
       
        middle = (env.plot3(points=np.array(((-0.5,0.5,0))),
                                   pointsize=0.5,
                                   colors=np.array(((0,0,0,0.5))),
                                   drawstyle=1))
       
        large = (env.plot3(points=np.array(((-0.5,0.5,0))),
                                   pointsize= 1,
                                   colors=np.array(((0,0,0,0.1))),
                                   drawstyle=1))


However, when we shift the order of plotting, e.g., first - middle, then small and then large:

        middle = (env.plot3(points=np.array(((-0.5,0.5,0))),
                                   pointsize=0.5,
                                   colors=np.array(((0,0,0,0.5))),
                                   drawstyle=1))
       
        small = (env.plot3(points=np.array(((-0.5,0.5,0))),
                                   pointsize=0.1,
                                   colors=np.array(((0,0,0,0.9))),
                                   drawstyle=1))
               
        large = (env.plot3(points=np.array(((-0.5,0.5,0))),
                                   pointsize= 1,
                                   colors=np.array(((0,0,0,0.1))),
                                   drawstyle=1))

Only two objects are visible: middle and the biggest. The smallest is not plotted.

So, the small objects that lays inside large and plotted later are not showed. Is that expected behavior? Otherwise one have to care about what to plot and when,  in order to keep it all consistent.

My solution was to draw spheres manually by combining surfaces, but its getting extremely slow and inefficient.

Thank you!

Best regards,
Sergey
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plotting oder of the half-transperent objects

baxelrod
I am not sure what OpenRAVE uses for 3D graphics, but I have had issues in the past in other libraries with semi-transparent objects.  I think it was with OpenSceneGraph.  Overlaying multiple semi-transparent 3D objects is a harder problem than you think, and these realtime 3D graphics libraries just don't handle it well.
-Ben

-----Original Message-----
From: Sergey [mailto:[hidden email]]
Sent: Thursday, April 10, 2014 7:00 AM
To: [hidden email]
Subject: [OpenRAVE-users] Plotting oder of the half-transperent objects

Hi All,

Suppose one have such code that plots 3 spheres one in another with different Alpha channel values. Everything works fine when first we plot the small object, then middle (that contains small) and then the biggest (that contains small and middle).

        small = (env.plot3(points=np.array(((-0.5,0.5,0))),
                                   pointsize=0.1,
                                   colors=np.array(((0,0,0,0.9))),
                                   drawstyle=1))
       
        middle = (env.plot3(points=np.array(((-0.5,0.5,0))),
                                   pointsize=0.5,
                                   colors=np.array(((0,0,0,0.5))),
                                   drawstyle=1))
       
        large = (env.plot3(points=np.array(((-0.5,0.5,0))),
                                   pointsize= 1,
                                   colors=np.array(((0,0,0,0.1))),
                                   drawstyle=1))


However, when we shift the order of plotting, e.g., first - middle, then small and then large:

        middle = (env.plot3(points=np.array(((-0.5,0.5,0))),
                                   pointsize=0.5,
                                   colors=np.array(((0,0,0,0.5))),
                                   drawstyle=1))
       
        small = (env.plot3(points=np.array(((-0.5,0.5,0))),
                                   pointsize=0.1,
                                   colors=np.array(((0,0,0,0.9))),
                                   drawstyle=1))
               
        large = (env.plot3(points=np.array(((-0.5,0.5,0))),
                                   pointsize= 1,
                                   colors=np.array(((0,0,0,0.1))),
                                   drawstyle=1))

Only two objects are visible: middle and the biggest. The smallest is not plotted.

So, the small objects that lays inside large and plotted later are not showed. Is that expected behavior? Otherwise one have to care about what to plot when and often try to keep it consistent.

Thank you!

Best regards,
Sergey



--
View this message in context: http://openrave-users-list.185357.n3.nabble.com/Plotting-oder-of-the-half-transperent-objects-tp4026951.html
Sent from the OpenRAVE Users List mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test & Deployment Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users



------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plotting oder of the half-transperent objects

Sergey
Hi baxelrod and all,
Thank you for the reply. Yes, sure. I was just interested if anybody else faced this problem. Perhaps the way to solve is to carefully track the order manually.

A bit side question. In case of drawing a complicated shape that consists of many pieces, it appears by piece by piece while drawing. In case of redrawing everything starts to blink. Is it possible to buffer it somehow and then show it at all once?

Best regards,
Sergey
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plotting oder of the half-transperent objects

Rosen Diankov
Administrator
hi guys,

coin3d has several transparency modes, two of the main ones being:

1. SORTED_OBJECT_BLEND
2. SORTED_OBJECT_SORTED_TRIANGLE_BLEND

2. is more correct, 1. is faster. For most of the stuff in oipenrave we use 2. except for plot3, which we use 1. since we've observed some undesired behavior with it.

Have you tried drawing triangles instead of using plot3? i think they should work fine...

as ben mentioned though, this is a difficult problem to fix and lies in the graphics library (coin3d) rather than openrave.

sincerely,
rosen,



2014-04-10 22:59 GMT+09:00 Sergey <[hidden email]>:
Hi baxelrod and all,
Thank you for the reply. Yes, sure. I was just interested if anybody else
faced this problem. Perhaps the way to solve is to carefully track the order
manually.

A bit side question. In case of drawing a complicated shape that consists of
many pieces, it appears by piece by piece while drawing. In case of
redrawing everything starts to blink. Is it possible to buffer it somehow
and then show it at all once?

Best regards,
Sergey



--
View this message in context: http://openrave-users-list.185357.n3.nabble.com/Plotting-order-of-the-half-transparent-objects-tp4026951p4026953.html
Sent from the OpenRAVE Users List mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users


------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plotting oder of the half-transperent objects

Sergey
Hi Rosen,

Yes, I draw spheres with triangles, and then its fine. At least up to my knowledge there were no such effect. The only drawback is that its pretty slow and animation is jerky. Anyway, thank you very much for the answer!

Best regards,
Sergey
Loading...