ChrisR Posted January 13, 2016 Share Posted January 13, 2016 Hi! I have been trying to get a second camera into my scene, so that this cameras view will overlay my main cameras view but just in the bottom left corner. Think if i wanted to create a mini-map, but to achieve this all i was doing was putting a camera way above the land looking down. Maybe best way to explain is please look at my example. http://www.babylonjs-playground.com/#1QXZAA#1 This is what i am trying to achieve. A second camera is looking at the same object but from a different angle. However, when you move the main camera with the mouse so that the objects in it are now positioned over the bottom left overlay, the objects go over top of my camera2 viewport since the objects are closer to camera1 then they are to camera2(z-buffering). How can i achieve this so that my bottom left overlay is always on top? is there a better way than view ports? like rendering the camera2's view to a texture that just overlays the canvas? Also, i had to create a third camera to force a white background on the viewport. Maybe there is a better way to do this? Thanks for any advice on how to proceed! Quote Link to comment Share on other sites More sharing options...
ChrisR Posted January 14, 2016 Author Share Posted January 14, 2016 Ok, so continuing looking into this, i have tried to just take a screen shot of the camera every time and place it on a dom element. This works for me, but i am afraid of how resource hungry this could be. Take a look: http://www.babylonjs-playground.com/#1QFVQI Still looking for maybe a better suggestion, unless someone with knowledge on how the screen shot is captured will confirm that this works just fine without to much resource consumption creating a new screen shot everytime. (what happens with the last screen shot in this example when it is replaced? does it get garbage collected? continue to consume resources?) Thanks! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 14, 2016 Share Posted January 14, 2016 Hello Screenshot is a great idea if you do it like every second for instance. how often do you plan to do it? For a minimap where objects can move often I would rather suggest the viewport approach. But there were a bug that I fixed so your example should just work fine now. Quote Link to comment Share on other sites More sharing options...
ChrisR Posted January 14, 2016 Author Share Posted January 14, 2016 Thanks Deltakosh, I was taking a screenshot every frame. I was extremely surprised at how well it worked though considering what it was doing. I'll get the lasted repo and give the viewport a try again. Thanks GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.