Remote camera / render to texture
by Sultan Ansari · in Torque Game Engine Advanced · 10/12/2006 (3:14 pm) · 2 replies
So here's what I will be implementing:
- The player will have a "Remote Control Camera" that flies
- the player will also have a "Laptop"
- the player will control the camera with a GUI on their Laptop
- the camera's view will be displayed on the Laptop monitor
I'm just doing preliminary research right now so here's a couple questions:
- Is the best way to go about this is render-to-texture?
- Anyone know of any resources with something like this already implemented?
Thanks in advance! =)
- The player will have a "Remote Control Camera" that flies
- the player will also have a "Laptop"
- the player will control the camera with a GUI on their Laptop
- the camera's view will be displayed on the Laptop monitor
I'm just doing preliminary research right now so here's a couple questions:
- Is the best way to go about this is render-to-texture?
- Anyone know of any resources with something like this already implemented?
Thanks in advance! =)
About the author
#2
In the dynamic cubemap code you can see how you can arbitraly render from another viewpoint in the engine. Using that knowledge, you can head over to GuiCanvas.cpp and create a function to render to your laptop camera texture before rendering the actual game frame.
Now, on the specifics, it all depends on how "hackish" or "pro-looking" you want your approach to be. The most fuzzy area is how to get the texture into your model. The easiest way, IMO, is to "expand" CustomMaterials. In custom materials, there are certain tags you can use instead of texture filenames, to access special textures which are speicified from within the engine, like lightmaps, refraction buffer, fog texture and others.
You can use the refraction buffer mapping as an example, and base your code off that, by creating another texture to be used as "remote camera buffer", use that as a render target to render the remote camera view, add a $remotecamera like tag to the customMaterial so you can map it to a material, and so on.
10/13/2006 (9:06 am)
Depending on how much you're familiar with TSE (aka: how much you're willing to "break" it), it's not very hard to do it.In the dynamic cubemap code you can see how you can arbitraly render from another viewpoint in the engine. Using that knowledge, you can head over to GuiCanvas.cpp and create a function to render to your laptop camera texture before rendering the actual game frame.
Now, on the specifics, it all depends on how "hackish" or "pro-looking" you want your approach to be. The most fuzzy area is how to get the texture into your model. The easiest way, IMO, is to "expand" CustomMaterials. In custom materials, there are certain tags you can use instead of texture filenames, to access special textures which are speicified from within the engine, like lightmaps, refraction buffer, fog texture and others.
You can use the refraction buffer mapping as an example, and base your code off that, by creating another texture to be used as "remote camera buffer", use that as a render target to render the remote camera view, add a $remotecamera like tag to the customMaterial so you can map it to a material, and so on.
Torque Owner Ben Sparks - Warspawn
StarOrdered Games