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

