screenshoot of second camera, texture to object

Blitz3D Forums/Blitz3D Beginners Area/screenshoot of second camera, texture to object

hi... i have a 3d scene in blitz...
in this scene, i have a 3d object, a monitor, and i want to see in the 3d monitor the image from another camera.. can i do that?

in camera1, i have my scene
in camera2, i'm going to have another part of the scene, that i want to see from 3d monitor in the scene of camera1

this is like if i wanted to make a mirror on a car, or the monitor inside the copick of aircraft...

and i need to capture the image each frame.

thanks for your help.. :)

Copyrect on the frontbuffer after a render and flip, to a texture. You can apply this texture to an entity and it will act as a mirror. Or, if the mirror is going to be flat and completely facing the camera, simply change the camera's viewport, so it fits into where you want the mirror.

I am not sure, but would it be quicker just displaying the viewport with a second render before the flip?

It seems extraneous to copy to a texture too.

Or is it faster to render to a separate buffer that's not rendered to the backbuffer?

It depends... if the "monitor" is just a flat square on the screen, he can get away just making a new viewport, but if it moves, if it's tilted somehow or can be viewed from more than one static pov, then there's no way other than rendering it to a texture and using that texture on a 3d model.

Too bad B3D doesn't have a direct render to texture, and we have to use this Copyrect trick...

If you can spare the cash for the fast extend, that comes with a speedy render to texture. If you do decide to copyrect to a texture, make sure you use the VRAM flag.

thanks..

so, i have my 3d monitor in perspective, i have only one option, copyrect.

copyrect is no to fast?... maibe i should use a optimization, something like not copyrect each frame... or somethig like that.

i want to do something like this (the image) in simulators like this when you can turn the view direction.
how'd they do this? (see the monitors imagen)
i suppouse copyrect is my option.




thanks..

I'm not sure where the second camera, or viewport is supposed to be? Rotate the camera?

Is the interior merely a bitmap image? I'm not sure what your trying to achieve :o)

If you are copyrecting, you can stagger this across two frames, by copying the bottom half, then the top half alternately. Or, have a look at the fast extend lib, where render-to-texture is available.

I assume you want something like this: Player is in room A with a surveillance monitor that is connetcted with a surveillance camera in room B.
IN fact you only have to create a camera at the camera-meshes position. Then you do it this way:

...
turn off camera a (using cameraprojmode !)
turn on camera B
renderworld (only the 256 pixels)
copyrect to texturebuffer
turn off camera B
turn on camera A
renderworld as usual
flip

As Ross said: use the VRam flag for this texture. Also make sure the cameraviewport is only eg. 256*256, esp. if the user won't see the virtual monitor much larger onscreen. Then it may also be an option to update only about 12 times a second, this is about original walt disney cartoons framerate. Copy-to-texture is the main bottle neck. Hint: a very small texture size will look much better when you add some kind of interlace effect (eg. erase every 2nd line).

Note right after the first renderworld you may add some fx to the render, like snow storm, screen distortion or inconsistent transmission quality artefacts.

It is a nice feature to use a camera as a real camera in the world, I've seen this in many nice games, especially NOLF, where I hate the missions that force you to stay hidden trough the entire level... :)

thanks :)..

i need the two options... and this information is very usefull.

i go to try now, to see if i can do it.

regards....
santiago

(sorry my english)

It depends... if the "monitor" is just a flat square on the screen, he can get away just making a new viewport, but if it moves, if it's tilted somehow or can be viewed from more than one static pov, then there's no way other than rendering it to a texture and using that texture on a 3d model.

Too bad B3D doesn't have a direct render to texture, and we have to use this Copyrect trick...



Ah yeah I didnt think of that. It sure would help having Render to Image or Texture functionality sure.