Hmm... Don't you have access to the shaders code?

If you do have, then change it and add the uniforms for the View setting
parameters to all of them. If not how do you know that they need view
depended parameters? :)

Guy. 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, April 09, 2008 9:18 AM
To: [email protected]
Subject: Re: [osg-users] Dilemma with the usage of object Shaders in
differend views ...

Hello Guy,

>If you set different shader for each object, I would like some
>clarification about your original question.

Yes this is that what i would have, sorry for my confused description.

>Do you want different shader per object but with some common features
>that are different for each view??

Normally the features should not different for each view, but they could
be 
differend between the objects. However you may have the option to
deactivate
or reset post processing effects, but this is not the problem, while
these
shaders are only exists in the view context and not shared between the
views.

Only the object shaders are the problem, they are view independend bound
to
the scene graph object StateSets, but they use view dependend values,
while
the scene graph is shared between the views ... By this reason the
object based
effects are exactly the same in differend views, while the
representation
is influenced by the view values ...

>If so, keep the shader as they were (differently setted) on the objects
>in the single view. 
Ok, i'm agree.

>Add to all the shaders uniforms for the "View"
>properties, and set the uniforms values differently at each View node.
Ok, but now i am back to the dilemma. How i could archieve this? If i
set i.e.
different uniforms for the cameras, how does the shader knows, which
should be
used?

The shader shouldn't have any application dependend logic, it's a
container,
feed with generic params to execute the code without any dependency to
the
application.

Best regards,
Christian


-----Original Message-----
From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of
Christian Heine
Sent: Tuesday, April 08, 2008 5:39 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Dilemma with the usage of object Shaders in
differend views ...

Well, the shader doesn't "know" of the stateset of the object (textures
attached) if you don't set it explicitly. Otherwise, the shader can be
inherited and at ObjectX you can add a uniform for the sampler.

You are right that all the objects will be rendered with the same
shader.

If you set different shader for each object, I would like some
clarification about your original question.
Do you want different shader per object but with some common features
that are different for each view??
If so, keep the shader as they were (differently setted) on the objects
in the single view. Add to all the shaders uniforms for the "View"
properties, and set the uniforms values differently at each View node.

Hope it helps,
 Guy.

-----Original Message-----
From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of
Christian Heine
Sent: Tuesday, April 08, 2008 5:39 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Dilemma with the usage of object Shaders in
differend views ...

Hello Guy,

>I think attaching a shader to each view instead of to object X would be
>fine.

I'm not sure if this may be the right thing. Correct me if I'm wrong but

this causes
in some other issues:

1. I lost the reference to the specifiv object states like Textures, 
Geometries etc. How
does the shader should access this values by differend objects?

2. If i bind it to the view, each object is rendered with this shader. 
So i shouldn't have
the ability to separate shaders and effects between objects ...

>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.

Ok, this is an argument i've to agree. But if If i overload the render 
method of the
composite viewer i could implement "callbacks" (better update sequences)

for each
object before calling the parent rendering method, so this should be 
possible. But i
am not sure about possible perfomance lacks ...

Best regards,
Chrsitian



Guy wrote:
> 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: osg-users-bounces at lists.openscenegraph.org
> [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of
> hellhound at binary-revolution.org
> Sent: Tuesday, April 08, 2008 10:55 AM
> To: osg-users at 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 at lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
> g
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
>
>   

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




_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to