Multiple camera with JME

Hello everybody,



I try to make a scene view by two camera at the same time,

the camera player and another camera.



it works (i have a look at camerantest and use the same render to texture technique) except that when the camera player doesn’t look at the object the secondary camera look at, the secondary camera doesn’t render anything (the object is culled for the two camera)



i have tried to render a clone of the node but it’s the same result…



any idea how i can achieve this ?



thanks for help,



adenthar.

Ok i have found the solution 8) ,

But since i’m a newbe be ready for the next question very soon :smiley:



bye,



Adenthar

Hi adenthar!



I’m a little curious about that. How do you solve the problem with multiple cameras?



Thanks.

Well, it’s a little method which works in my specific case :



i wanted a monitor which display a zoom view of an object selected in the game.



So here’s what i’ve done :



the main scenegraph contains the monitor node with the render to texture attach to it.



i made a secondary scenegraph then with the secondary camera, this scenegraph is virtual ie it is not rendered since it is not attach to the main scenegraph.



when the user select an object i do the following :


  1. Clone the selected object,
  2. Attach the clone to the virtual scenegraph
  3. Move the clone in front of the main camera : this is the trick, it’s necessary otherwise the clone will be culled. Since it is on the secondary scenegraph it is not visible on the main camera but visible by the secondary camera.
  4. Move the secondary camera in the position i want to see the clone
  5. Order the render to texture to render : the secondary scenegraph on the texture of the monitor node
  6. that’s it ! :slight_smile:



    it works since i made only one render each time the player selected something and only one object. in continuous rendering and with complex scene to render by the monitor, perhaps this method could cause some performance issue.



    Hope this could be useful for someone,



    Bye,



    Adenthar.