Brad,
It really sounds like texgen stage conflict. You can use up to 8 texgens
concurently (stages 0..7). PositionalStates (including TexGens) are apllied
at start of render stage and not changed during rendering. So if there are
more then one texgen on particular stage, only one will be used (I am not
sure which will win the race). If you are sure, texgens are applied on
unique stages, check if your shaders use the correct texgen indices.
Wojtek
-----Oryginalna wiadomość-----
From: Christiansen, Brad
Sent: Friday, January 21, 2011 9:29 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] multiple tex gen modes in a single scene
Hi,
I have a small amount of extra info to add, which confuses me even more.
Revisting all my code I discovered that my overlays actualy use two eye
linear tex gens (one for close items, one for distant ones, a bit like the
parralel split shadow maps) with different matrices and different units.
These work fine in isolation, but don't work when I add in the third shadow
tex gen. The code that adds the tex gens to the positional state container
is almost identical.
I am now very confused as to why I can use two tex gens for my overlays but
it wont work with shadows added.
Cheers,
Brad
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
Christiansen, Brad
Sent: Friday, 21 January 2011 3:47 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] multiple tex gen modes in a single scene
Hi Robert,
I am currently adding shadows to my scene (which is going well) but in doing
so I have hit this issue. I already use an eye linear tex gen in my scene to
render overlays (very similar code to the osgSim::OverlayNode). I don't
think it would be possible for me to split the renderering accross two
different RenderStages as the two tex gens are used from within the same
shader to render my terrain (one for applying shadows and the other for
applying overlays).
I have had a look at the PositionalStateContainer class and I do not
understand why the issue exists. The tex gens use different texture units
and as such there matrices are stored and applied seperately. However the
result I am seeing is one of the two always 'wins' and its matrix is applied
to both tex gens.
This is an issue I will need to resolve so I am hoping you could provide
some more guidance as to what would be the best solution.
Cheers,
Brad
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Robert
Osfield
Sent: Thursday, 13 January 2011 6:27 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] multiple tex gen modes in a single scene
Hi Paul,
Eye linear glTexGen is positional state, i.e. it's value depends on
the current modelview matrix, so has to be treated by the OSG like
other positional state like glLight and glClipPlane. All positional
state has to be positioned by a positional state node, and for
glTexGen this is TexGenNode.
During the cull traversal the OSG collects the positional state and
binds the TexGen/Light/ClipPlane to modelview matrix at that point in
traversal, this binding is done via the PositionalStateContainer, and
there is one of these per RenderStage. During the draw traversal the
positional state is then applied prior to the traversal of the
RenderStage, and fixes each positional state in the appropriate place.
While this technique doesn't properly fix the state as required, it
does limit you to one position, per stage, you can't have two eye line
tex gens/lights/clip planes applied on two separate subgraphs.
Object linear TexGen isn't positional state so can be applied in the
normal way and you have multiple of these per stage without problem.
To have multiple Eye linear TexGen/TexGenNode's you'll need to break
the scene up into multiple RenderStage and use the clear mask set to 0
on the subsequent stages so that each stage overlays correctly on the
previous one. Other approaches are to write a custom TexGen that you
push/pop a custom modelview matrix. I'm afraid both approaches are
rather hacky.
Robert.
On Thu, Jan 13, 2011 at 2:28 AM, Paul Martz <[email protected]> wrote:
Hi all -- Has anyone ever successfully used multiple TexGen modes (say,
EYE_LINEAR and OBJECT_LINEAR) on different objects in the same scene? What
is the recommended way to do this in OSG?
The TexGenNode has a pointer to a TexGen, and the TexGen has the mode. I
assume I should create two TexGens, one OBJECT_LINEAR and one EYE_LINEAR,
and two TexGenNodes to reference them, and add the two TexGenNodes to the
scene graph. Then, I assume I should attach the same two TexGens as
StateAttributes to different Node's StateSets as needed.
I am running into some issues with this. If it sounds like I'm doing
everything right, I'll post a small example that fails, or dig into the
OSG
code. More than likely, I'm doing something wrong here, so I just wanted
to
ask what the intended usage is.
Thanks,
--
-Paul Martz Skew Matrix Software
http://www.skew-matrix.com/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
DISCLAIMER:---------------------------------------------------------------------------
This e-mail transmission and any documents, files and previous e-mail
messages
attached to it are private and confidential. They may contain proprietary or
copyright
material or information that is subject to legal professional privilege.
They are for
the use of the intended recipient only. Any unauthorised viewing, use,
disclosure,
copying, alteration, storage or distribution of, or reliance on, this
message is
strictly prohibited. No part may be reproduced, adapted or transmitted
without the
written permission of the owner. If you have received this transmission in
error, or
are not an authorised recipient, please immediately notify the sender by
return email,
delete this message and all copies from your e-mail system, and destroy any
printed
copies. Receipt by anyone other than the intended recipient should not be
deemed a
waiver of any privilege or protection. Thales Australia does not warrant or
represent
that this e-mail or any documents, files and previous e-mail messages
attached are
error or virus free.
--------------------------------------------------------------------------------------
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
DISCLAIMER:---------------------------------------------------------------------------
This e-mail transmission and any documents, files and previous e-mail
messages
attached to it are private and confidential. They may contain proprietary or
copyright
material or information that is subject to legal professional privilege.
They are for
the use of the intended recipient only. Any unauthorised viewing, use,
disclosure,
copying, alteration, storage or distribution of, or reliance on, this
message is
strictly prohibited. No part may be reproduced, adapted or transmitted
without the
written permission of the owner. If you have received this transmission in
error, or
are not an authorised recipient, please immediately notify the sender by
return email,
delete this message and all copies from your e-mail system, and destroy any
printed
copies. Receipt by anyone other than the intended recipient should not be
deemed a
waiver of any privilege or protection. Thales Australia does not warrant or
represent
that this e-mail or any documents, files and previous e-mail messages
attached are
error or virus free.
--------------------------------------------------------------------------------------
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org