What happens if I attach a program shader to a group node and then a different program shader to the child node? Are both shaders executed? Just one? What order? Precedence, etc?
Thank you!
Cheers,
GB
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=41831#41831
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> What happens if I attach a program shader to a group node and then a different program shader to the child node? Are both shaders executed? Just one? What order? Precedence, etc?
The same rule as for any other state applies here: a state attribute on
a child is inherited from the parent, unless the child specifies its own
attribute.
However, shaders are not executed while traversing the graph, they are
only executed when something is drawn. Only one state attribute can be
active on a given state set at a time, so no, shaders cannot be combined
like that. So the question is which program is active on a given
drawable, and that is determined by the path down to the drawable and
which program was last encountered on that path.
Say you have
root <-- programA
/ \
/ \
no program --> Node1 Node2 <-- programB
Well, if Node1 has any drawables under it, programA will be active when
those drawables are drawn, and if Node2 has any drawables under it,
programB will be active for them.
Hope that helps,
J-S
--
______________________________________________________
Jean-Sebastien Guay jean-seba...@cm-labs.com
http://www.cm-labs.com/
http://whitestar02.dyndns-web.com/
How can you apply a shader effect to the entire scene, AND another effect to only a part of the tree?
Thanks,
Stephen
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=41851#41851
Glenn,
Thanks for the response. Do you know where I can find the
osgvirtualprogram example?
The program I have worked on has recently moved from osg 2.2 to 2.8.3 (dark
ages, I know). I do not see osgvirtualprogram in the osg examples
directories for 2.2, 2.8.2, or 2.8.3.
I am adding precipitation effects (and dust effects) to a project that
currently uses shaders produce a rendered scene that represents sensor
returns - the render target is read back by the main program,
where the data is consumed. For the app/channel that has the sensor, the
program/shader is added to a node near the top of the tree. I have added
the precip effect program/shader to a node slightly below this one - at the
same level as the top terrain and entities node. The sensor shader
basically does range calculation, applies some error, and does some
processing for alpha fragments. For the visual channel, that has no higher
shaders, this works fine. However, for the sensor channel, the precip
particles don't get seen by sensor shader.
My implementation of rain/snow is based on a slightly modified
osgPrecipitationEffect. Perhaps shader is not the way to go for the precip
effect, but I thought it would provide the best efficiency. Nevertheless,
I can definitely see the need in the near future to have multiple,
accumulated, non-overriding effects. Currently, I would like to be able to
have the results from osgPrecipitationEffect like shader be seen by the
higher sensor shader.
Any thoughts?
Stephen Haithcock
General Dynamics Land Systems
38500 Mound Rd.
Sterling Heights, MI 48310
MZ 436-40-15
(586) 825-8573
Glenn Waldron
<gwaldron@gmail.c
om> To
Sent by: osg-...@lists.openscenegraph.org
osg-users-bounces cc
@lists.opensceneg
raph.org Subject
Re: [osg-users] Multiple Shaders
08/05/2011 05:35
PM
Please respond to
OpenSceneGraph
Users
<osg-users@lists.
openscenegraph.or
g>
Stephen,
http://github.com/gwaldron/osgearth/blob/master/src/osgEarth/ShaderComposition
Thanks,
Stephen
This is an e-mail from General Dynamics Land Systems. It is for the intended recipient only and may contain confidential and privileged information. No one else may read, print, store, copy, forward or act in reliance on it or its attachments. If you are not the intended recipient, please return this message to the sender and delete the message and any attachments from your computer. Your cooperation is appreciated.