   Age old camera + scene graph problems :(
  Hey,My previous scene graph system did not use the composite/leaf system of the composite design pattern. This graph im coding atm now uses it. So when doing a render, it would just push world transform state onto the world stack as it hits a DOF node. But, how do I get the view matrix for the camera?I thought about having a view composite node that the has the camera as a parent but still.. all nodes that are rendered before the camera won't have the view transformation.I have a feeling the key to my problem is thinking more outside the box - ie, the scene graph is for more than just rendering.If anyone can help me get to the root of this problem and solve it, I'll be super-duper-uber greatful :)   
  I actually kind of mimic the api, I have member variables in my renderer that get set away from the scene graph.  So the scene graph is used to update all the nodes in the scene graph, then the game logic selects which camera is active and sets the view in the renderer.  The same holds true for the projection matrix as well.  Depending on the camera, a different projection matrix can be used.  Is this a possibility in your situation?   ;  I don´t know whether this idea is feasible at all, but I´d post it never the less:I´d use the scene graph to represent the scene independent from the camera that views it. So no view or projection matrix in the scene graph, just the geometry, world matrices and perhaps some other stuff you might find useful.For the camera (i.e. the view and projection matrix) I would use Jason´s approach of setting it "outside" the scene graph. The reason why I would do this is because you normally want to render the whole scene from one view at a time, so you´d go and set the first camera you want to use, do the culling and so on using that camera, render the scene, set the next camera and repeat.I´d guess the case of a view changing during a single render pass would be quite strange and would yield weird results.   ;  I think what I'll do is just that. I will have my camera class out of the scene graph, with a property called "location node". This well be one of my DOF nodes, and my DOF nodes have a "world matrix" property that I can easily get. I think this is going to be the clearest and easiest implentation, and it also allows me to still indirectly attach the camera into the scene graph. Thanks for the advice!   ;  I have camera nodes as leaf nodes in the transform hierarchy, but when one calls the "render" function, one can pass a pointer to the requested camera node. The renderer then simply grabs the inverse world matrix at that node (which becomes the "view" matrix) and the projection matrix (generated from camera properties and type: virtual function in camera node) and calls the generic version of render (which can also be used by the outside, passing view/projection manually). Of course once the render pass has been started, one only cares about the view/projection matrices anyways so there's no need to worry about the node anymore.It's a good system, avoids duplication of orientation-controller type nodes (ex. "look at" works for cameras just as it works for spotlights or geometry) and doesn't seem to have any downfalls.   