ZackMFleischman Posted July 12, 2016 Share Posted July 12, 2016 Hi! So I want to have a mini-me view of a mesh that will always be present in a little bubble in the lower left of my screen. I figured the best way to do that is to have two active cameras. One is my regular camera as per usual, and the other is in a small viewport in the lower left with a layer mask that filters out everything except an extra instance of my mesh. However, I'm noticing some strange behavior where only the first active camera will actually show the mesh and the instance. That is to say, I create the instance, and all is well, but then I push the new camera on the active cameras array and the new camera does not see either the mesh or the instance. If I switch the order of the active cameras (that is to say us unshift instead of push on the activeCameras), then the mesh and it's instance are both visible in the new camera, but not the old. Do any of you have insight to how mesh instances work with cameras? I assumed it would be the same, but there seems to be some magic going on. Thanks. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 13, 2016 Share Posted July 13, 2016 Hiya @ZackMFleischman, welcome to the forum, good to have you here! Sorry for the slow reply. Yeah, activeCamera (with no 's') and activeCameras (with 's')... they are funnnnn. (no, not really) We got a thing here called a 'renderTargetTexture'. It... does just that... grabs a renderTarget, and makes it a texture... which can then be used on a near-camera plane (parented to camera to make a corner panel)... or use it with Babylon.Layer to make a foreground layer... or use it with our new Canvas2D system. RenderTargetTextures are super-handy. Let's take a search of the playground database... http://doc.babylonjs.com/playground?q=renderTargetTexture&page=1&max=400&bf=all Wowzers, we have results! Here's a weird/complicated demo, but it uses a renderTargetTexture nicely, in lines 51-55. http://www.babylonjs-playground.com/#5RGDQ#13 That also uses our new Canvas2D system... so it's fresh. Whomever coded this... knows what they are doing, and this might be a benchmark/proof-of-concept demo. Nice code. I bookmarked it violently, for my own future learning. http://www.babylonjs-playground.com/#1WROZH#6 1 main view, 4 sub-views. Crazy! Lines 39-57 do the dirty deed. I hope this helps. A forum search might help, too. Again, welcome to the forum... let us know your thoughts on ANYthing... (like project ideas and "can it be done?" questions.) We love that stuff... 'round these parts. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted July 13, 2016 Share Posted July 13, 2016 i was not sure i read the question an was thinking of layershttps://doc.babylonjs.com/tutorials/Layermasks_and_Multi-cam_Textures Best Quote Link to comment Share on other sites More sharing options...
ZackMFleischman Posted November 6, 2016 Author Share Posted November 6, 2016 Lol, just seeing this now. Fortunately still very relevant!! Ohhhh renderTargetTexture is nifty! I think that will do nicely! Thank you 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.