xtreampb Posted March 23, 2014 Posted March 23, 2014 So lets say i wanted to do a racing game and have a 'rear view mirror' on the screen. I would use a second camera right. So how would I display the image over the first. Also Lets say i wanted to put 2 views side by side. A top down and a 3d perspective, similar to the editor. How do I display the multiple views? This can be either LE 2.5 or 3.x Thanks in advance ~Xtreampb~ Quote bool Life() { while(death=false) { if(death==true) return death; } } I have found the secret to infinite life Did I help you out? Like my post!
shadmar Posted March 23, 2014 Posted March 23, 2014 You move the camera where you want and call world->render() which renders to a texture using a buffer. You can draw the texture using drawimage or on a 3d object as a texture. There should be a lua example on the wiki somewhere. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB
Rick Posted March 23, 2014 Posted March 23, 2014 http://leadwerks.wikidot.com/wiki:render-to-texture-security-cam Quote
DudeAwesome Posted March 24, 2014 Posted March 24, 2014 is this the best way to do this? I dont think so. when I play a game and see 2 or more views in one window or just take a look into leadwerks 4 views. this are just textures ??? Quote It doesn´t work... why? mhmmm It works... why?
AggrorJorn Posted March 24, 2014 Posted March 24, 2014 This is how rendering a single window works, so technically nothing is changing apart from that you are rending multiple buffers to a texture. 1 Quote
DudeAwesome Posted March 24, 2014 Posted March 24, 2014 mhmmm ok this seems logic but it feels like wrong ok learned something new. Quote It doesn´t work... why? mhmmm It works... why?
Michael_J Posted March 24, 2014 Posted March 24, 2014 Absolutely--rendering rear view mirrors and such to a texture, and then displaying that on geometry in the main view, is how it's done. Trust me--I've worked on racing simulators since 2005 Quote --"There is no spoon"
xtreampb Posted March 24, 2014 Author Posted March 24, 2014 what about if i wanted to do this in C++? Is there a tutorial or the like on the wiki? EDIT: Disregard i'm an idiot after work. Quote bool Life() { while(death=false) { if(death==true) return death; } } I have found the secret to infinite life Did I help you out? Like my post!
shadmar Posted March 24, 2014 Posted March 24, 2014 Here is an example for 3.1 in c++ , just compile and run. App.cpp.zip 2 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB
xtreampb Posted March 24, 2014 Author Posted March 24, 2014 Thanks a lot shad. I understand that flow a lot better for some reason. This displays what my main camera is looking at. What i'm wanting is a way to draw a second camrea view on the same window, not a duplicate of my current camera. How do i change which camera i pull my image from. Would i create a second camera, disable my first, enable the buffer, render, disable camera, enable main camera, switch context, get material, render. Is that more or less the proper procedure? Quote bool Life() { while(death=false) { if(death==true) return death; } } I have found the secret to infinite life Did I help you out? Like my post!
Rick Posted March 24, 2014 Posted March 24, 2014 You don't have 2 cameras. Instead in 1 frame you move your 1 existing camera to a point (you can define this location with a pivot or something), basically take a "screenshot" of what that camera sees, then move your camera back to it's original position (probably your FPS or something) and render that "screenshot" (buffer) to a texture that is part of a material already that is applied to some 3D object. So the important thing to note is that you only have the 1 camera and you'll need some markers (pivots) to place that camera and take "pictures" all in one frame. Quote
shadmar Posted March 25, 2014 Posted March 25, 2014 Just move and rotate your camera prior to the first render and restore the position before context is rendered. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB
AggrorJorn Posted March 25, 2014 Posted March 25, 2014 Wouldn't this also be possible with multiple camera's? It seems like an adventage to use the camera object in your scene for this. Not only do you have a proper debug view for the camera rotation and alignment, you can also set specific shaders or post effects on that camera. Quote
shadmar Posted March 25, 2014 Posted March 25, 2014 I guess, haven't tried, just hide your context camera and show your rearview camera and vice versa, just don't have both active at the same time when render is called. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB
Rick Posted March 25, 2014 Posted March 25, 2014 I'm not sure if hiding cameras does the "deactivation" of them or not. Would have to test. Quote
Dralel Posted December 31, 2015 Posted December 31, 2015 Sorry for resurrection, but did you get a camera to hide working? Quote
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.