Jump to content

Create a Viewport or RenderTexture over my scene


ChrisR
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...