Hi Viggo,

It sounds like you need a feature that the OSG doesn't have, the
ability to do StateSet substitution, i.e. you take a StateState this
is attached to the scene graph, but rather than use this directly when
setting up the rendering backend it gets substituted with the one you
actually want.

You could possible implement it via a traversals of the
osgUtil::StateGraph that is built by the CullVisitor, or perhaps just
modify CullVisitor to do this StateSet substitution as it builds the
StateGraph.

Robert.

On Thu, May 22, 2008 at 2:57 PM, Viggo Løvli <[EMAIL PROTECTED]> wrote:
> Hi,
>
> My scene contains models that use one or many textures, some use vertex and
> fragment shaders of different kinds. Complex but good looking :-)
>
> I need to render the scene many times each frame.
> The first render is a normal one, so I need no change in textures, states or
> shaders.
> The second render is a multi target render. Here I need to change all the
> fragment shaders that my scene uses. Each shader need to output data to each
> render target.
>
> My question is:
> - What is the best way to switch shaders on many models in my scene-graph?
>
> One way to do it is to put a shader on the top node and override all child
> nodes, but that only works if the entire scene-graph renders with the same
> shader. My scene uses different shaders, so overriding is not the solution.
>
> One idea I have is to parse through all scene graphs that I add to my world
> and duplicate all nodes that sets a fragment shader. I could then create one
> shader for the normal render and one for the multi target render. This would
> require that I mask those nodes so that the correct ones are used in each
> render. This will require me to write my own function for adding nodes to
> the scene.
>
> Anyhow, I would be very happy if someone could guide me in the right
> direction on this one.
>
> Regards,
> Viggo
>
>
> ________________________________
> Si det direkte med Windows Live Messenger. Lei av å vente på svar?
> _______________________________________________
> 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