Using Shared nodes?

Hi Guys. 



Im trying to use shared ndoes in the DarkMMo client since the maps are tile based in order to save memory.



Unfrotunately, my experiments so far have been a bust.  When I attempt to share a tile, its transforms get all fugly inside its tree.



Basically, my data design is this…



WorldRoot
    Tile00RotationNode
        Tile00PositionNode
            TileRoot1
               ....
   Tile01RotationNode
        Tile01PositionNode
            TileRoot2
               ....



That works if the TileRoots are real node trees.  But if I try to replace them with a shared node that points to  a common tree
like this they get all messed up.


WorldRoot
    Tile00RotationNode
        Tile00PositionNode
            SharedNode(TileRoot1)
               ....
   Tile01RotationNode
        Tile01PositionNode
            SharedNode(TileRoot1)
               ....



What is the proper way to share a sub-grpah at multiple places in the scene graph?  I need a graph, not just a shared mesh,
because the tile is made up of a bunch of meshes each of which is individually positioned by its own tile-internal transforms.

Edit:  Note.  I gave all my shared nodes the same name.  That couldnt be screwing it up, could it?
Edit: Nm, I checked and thats not true, they do all get unique names based on their position in the tile map

Hmm, not run into that problem, but at work we create shared nodes and set the rotation and position directly on them…

The  SharedNode is itself not shared, right?  Theres one per join point?



really I should have drawn the second tree like this for clarity…



WorldRoot
    Tile00RotationNode
        Tile00PositionNode
            SharedNode00(TileRoot1)
               ....
   Tile01RotationNode
        Tile01PositionNode
            SharedNode01(TileRoot1)
               ....



Thats what Im doing now...

Some screen shots.



This is what it looks like when its correct.  Using separate copies of the tile graph for all 4 corners:







And this is what it  looks like when i just use one tile graph and 4 shared nodes:







It kind of looks like the proper transforms are only getting applied to one of the children of the child of the SharedNode.  Is it possible SharedNode is assuming only one child of the node that is attached to it somehow?




i think you want to rotate the tiles around its own axis right?

Try to attach the rotation to the position node and not the other way around.


Wouldnt that rotate about the world origin and not the tile origin?



Whats telling is that the same transforms work fine with duplicated tile graphs.



Im thinking that the stuff thats not getting positioned right might be positioned with controllers, which would technically make it a one-state animation.



AIR SharedNodes don't handle animations well, true?



I'm thinking maybe Ill have to go lower and just cache and share meshes.  Thats where the bulk of the work and memory is anyway, in making the meshes…

SharedNodes are nothing really special… They are simply Nodes.  They don't even make use of the target Node past the original copy.  So it sounds like you have problems elsewhere.  Perhaps you could post your setup code.  I've seen problems similar to this when people have done things like make improper use of the UNIT_XXX vector fields or mix up world and local rotations somehow.

Id be happy to post… the code is a bit tricky in that its in two places…  the code that builds the tree down to the shared node is in one place.  The code that builds the tile sub-graph is in another.

Of the two the sub-graph is significantly more complex because its data driven by the model file.



Which would you like to see?

Post them both :slight_smile: I answer instead of Ren, so that the next time he reads this thread he could already help you instead of saying 'no 1' or 'no 2'



Edit: And of course for the additional reason that I am gonna pillage your source for every scrap of re-usable code it has :slight_smile: