Joakim Posted November 29, 2015 Share Posted November 29, 2015 HiI am making a small car game in which I have different camera views. When viewing from within the vehicle I display two viewports showing the view of two rearward-facing cameras.Does anyone know if it is possible to flip the view of from these cameras (or flipping the viewports) to mimic the behavior of a mirror?Thank you! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 30, 2015 Share Posted November 30, 2015 Hello instead of a viewport you can use a renderTargetTexture and render a specific camera view on it Quote Link to comment Share on other sites More sharing options...
iiceman Posted November 30, 2015 Share Posted November 30, 2015 That sounds cool. Do we have examples for that? How would one define what camera view to use? And to make it do something! I don't know how to start: http://www.babylonjs-playground.com/#145AGC#0 Quote Link to comment Share on other sites More sharing options...
Temechon Posted November 30, 2015 Share Posted November 30, 2015 Almost http://www.babylonjs-playground.com/#145AGC#1 iiceman 1 Quote Link to comment Share on other sites More sharing options...
iiceman Posted November 30, 2015 Share Posted November 30, 2015 I was really close indeed, eh? Thanks for the fix, stupid mistake as usual... I really have to learn to look a bit closer and figure those things out myself Quote Link to comment Share on other sites More sharing options...
Joakim Posted May 3, 2016 Author Share Posted May 3, 2016 Hi again! I would like to give this subject some closure. I tried this approach again, and this time I got it to work! I was able to extend your example by adding a "screen" which renders a mirrored camera view. See the text marked with "ADDED". The result is shown when the camera is rotated.http://www.babylonjs-playground.com/#145AGC#8 The solution was simply to set the "uScale" to -1, and not to forget to call the "render" function in the "registerBeforeRender" event. When implementing this in my game I ran in to a problem. The "activeCamera" on the texture was always the scene's active camera. It turned out I had to upgrade from 2.2 to 2.3 to fix this issue. After that, I ran in to some new, unrelated problems; my way of moving the "driver's" camera does no longer work in 2.3 - I will have to work on that =) iiceman 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 3, 2016 Share Posted May 3, 2016 Coooooool! Hi J, welcome to the forum! Hey, do you "need" to use mirrors? RenderTargetTexture might be more powerful than you think. http://www.babylonjs-playground.com/#1WROZH#6 Is there anything in that goofy playground... that could help your cause? Why use mirrors when we can duct-tape a camera to the back of our helmet? Talk again soon. adam 1 Quote Link to comment Share on other sites More sharing options...
Joakim Posted May 4, 2016 Author Share Posted May 4, 2016 Thanks, but I did use RenderTargetTexture! =) It did the trick. 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.