Hello Mateusz,

When you use instanced drawing you cannot have correct semi-transparent objects, as there is no sorting involved. One option is to sort your instanced obejcts in every frame or to use some order independent transparency approach.
Also concerning your Material and stateset problems:
When using instancing you will somehow have to pass per instance data to your shaders and evaluate them there. So if you need per instance colors you need to pass an array which hold the instance color.
It will not work using osg::Material out of the box.
cheers
Sebastian
Hi,

I have implemented the simplest fragment shader applying only particular color 
to my primitives as this was sufficient. However now I want to create a 
composition of a simple osg::ShapeDrawable for a osg::Box and my instanced 
material (spheres), where Box should be semitransparent and so should be the 
instanced material. But what I get You can see in the attached photos. In the 
first one Box is theoretically transparent, but I can`t see the material inside 
it. In the second photo, if I am inside the Box I can see both semi 
transparent: box and material. Does anyone know how to fix it also for viewing 
box from outside to be transparent and material inside would be visible? 
Probabbly some neaty StateSet configuration or more complex fragment shader? 
Additionally - does osg support Material for instanced objects or I have to 
implement it with whole light manualy in fragment shader? I was thinking about 
some default osg fragment shader providing complete light and material handli
  ng but I think such thing does not exist. Am I wrong?


Thank you!

Cheers,
Mateusz

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56358#56358





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to