On 14 May 2010 22:18, Paul Martz <[email protected]> wrote: > Frank Sullivan wrote: > >> But I want to make the wheels look as though they are turning as well. I >> accomplish this with a simple texture matrix. I simply find the node that >> represents each wheel, and I add a texture matrix to each of them that will >> slide the s/t coordinates of the wheels' textures so as to give the illusion >> that the wheels are turning. >> >> This seems to work well also. Well enough for my purposes, anyway. >> >> The problem is when I have two cars in the scene, and the graph looks like >> it does above, I can't turn the wheels on one car without turning them on >> the other as well. >> >> Is the best solution to this to do a deep copy of the car's sub-graph >> rather than reusing the same sub-graph with two different matrix transforms? >> > > If the texture matrix is in the shared part of the subgraph, then the same > texture matrix will be used for both instances -- that is sort of the > definition of sharing. You have correctly observed that making a hard copy > will eliminate both the sharing and the issue you've encountered. > > Another solution would be to use shaders to render the wheels. Each matrix > transform would specify a uniform to transform the texture that's applied to > the wheel texture coordinates. > > You've become a shader harlot. ;)
Frank: If you don't want to use shader magic, you could split your car into body/wheels and share the car body. Also you could set the texture matrix on the parent transform and set the textures on all of the car except the wheels to be PROTECTED. I'm guessing you'd get better perform with the shader route though. -- http://www.ssTk.co.uk
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

