Hello,
 I think attaching a shader to each view instead of to object X would be
fine.
 If you want to use the callback I think you should create a pre-draw
callback to the object, which I'm not sure possible. The update
callbacks won't help you since it run on all the scene before the
rendering and then only the last setting of the shader will be set, and
it also might affect performance. So I still think attaching shaders to
the views would do what you want.

Guy.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Tuesday, April 08, 2008 10:55 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Dilemma with the usage of object Shaders in
differend views ...

Hi folks,

actually i am working on object shading with OSG (i.e. Dot3). All works
fine
with single views. Now i am using the osgViewer::Composite viewer and
getting
some dielemma with the usage of object based shaders in differend views
based
on the same scene graph.

I.e.: I've a single scene node with an object X where i bind the shaders
(at 
the object StateSet) for execution. In a single view no problem. If i
use this scene in 
multiple views (i.e. A, B) i've the dilemma, that i've to use diffrend
shader params
on the same shader instance. In each rendering pass the params of the
camera
are differend from the point of view of the views, if the views are
rendered. But
the shader has no knowledge about this, it uses only a single uniform to
hook bind
param ...

I've thought about the following sollutions:

1. Using for each view a single shader instance at the same object
StateSet.
Is this usefull? If the scene is complex i could get a huge count of
shaders
which have to be executed. Additionally i'm not sure, if the binding of
the "unused"
shaders produces render artifacts or perfomance issues...

2. Using a callback mechanism which switches this values at the shader
before 
   rendering

How i could achieve this aim in best way? Has anyone a better solution? 

Best regards,
Christian 



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

Reply via email to