CCTV and Monitor

Blitz3D Forums/Blitz3D Beginners Area/CCTV and Monitor

Obliteration(Posted 2014) [#1]
Hello, sorry for bothering anyone but can anyone tell me how to create "CCTV" and monitor?

I am sure it use 'create camera' but I still can't figure out how to create proper CCTV.

Any help is really appreciated.


Thank you for your time reading this.


Yasha(Posted 2014) [#2]
Basic steps:

1) Create your monitor. Create a texture for the display part. Apply the texture to the display part. Keep the texture handle available. (let's call it `dTex`)

2) Create the CCTV camera. Position it wherever it's supposed to be. Animate it if you're using animation

3) Use CameraViewport to set its viewport to 0, 0, TextureWidth(dTex), TextureHeight(dTex)

4) Disable the CCTV camera with CameraProjMode

5) In your main loop, do the following:

5.1) All movement updates for your game, as normal (including camera movement control if it's not being controlled by animation). UpdateWorld as normal

5.2) Disable your main perspective camera(s) with CameraProjMode. Hide anything you don't want the CCTV to be able to see (e.g. floating HUD objects)

5.3) Enable your CCTV camera with CameraProjMode
5.4) RenderWorld
5.5) CopyRect the rectangle described by 0, 0, TextureWidth(dTex), TextureHeight(dTex) from the BackBuffer to the CCTV display texture's TextureBuffer
5.6) Disable your CCTV camera with CameraProjMode

5.7) repeat 5.3 - 5.6 for any other CCTV cameras

5.8) Enable your main perspective camera with CameraProjMode

5.9) RenderWorld, Flip, etc.


You might need to use the 256 flag when creating your display texture to get decent performance... (I can't remember whether this is necessary, sorry)


Obliteration(Posted 2014) [#3]
I see, thank you very much for your time responding my question.

By the way, which software you'll recommend to use to create monitor and CCTV?

Or it doesn't necessary?


Who was John Galt?(Posted 2014) [#4]
It's all Blitz 3D.


Obliteration(Posted 2014) [#5]
What do you mean, 'It's all Blitz 3D'? Everything done here?

I am new here and I create a map by Maplet, it working just fine but how do I create camera and place it?

Thank you for your time reading this.


RemiD(Posted 2014) [#6]
If you want to have a screen in the scene which displays a view of the scene, you need to create one screen mesh (a quad mesh with 4 vertices, 2 triangles) and a texture with enough pixels, depending on the size of the screen mesh so that the image is not distorted.
For example, if i create a graphicswindow of 640x480 pixels on my laptop computer, the screen measures 10.2x13.6cm and there are 640x480pixels.
So in order to reproduce this in a 3d world, you create a screen mesh of 0.102x0.136units and you apply a screen texture of 640x480pixels (it is a bit more complicated because you have to use a power of 2 texture and calculate and set appropriate UVCoords, but this is the basic idea)
Then you can use a camera which has the same resolution than the texture (in pixels) to render a view of the scene and then copy the render to the screen texture and the render will be displayed on the screen mesh.

If you don't understand what i have explained, i suggest to follow some tutorials, read some code examples in the codes archives and in the demos provided with Blitz3d, read the doc, then it will become clear.

(also reread the explanations by Yasha)

useful commands :
createcamera()
cameraviewport()
createtexture()
setbuffer()
backbuffer()
texturebuffer()
renderworld()
copyrect()

Good luck !


Obliteration(Posted 2014) [#7]
Mm. Okay, I'll try my best.

Thank you very much for your time explaining me, Yasha, John Galt and RemiD.


RemiD(Posted 2014) [#8]
Take a look at this example :
http://www.blitzbasic.com/codearcs/codearcs.php?code=3029

This will give you an idea about what is a quad mesh and how to apply a texture on a quad mesh.


Obliteration(Posted 2014) [#9]
Okay, I'll try my best to not bother you guys again.

Thank you very much, it really help me.


Yasha(Posted 2014) [#10]
You're not bothering anybody - as long as you don't understand something, you should always feel free to ask more questions. That's what this place is for.

Obviously you should read up too, but if you need help understanding the examples or documentation, someone will try to give it to you.


One thing though is that you might get better answers if you provide more context, especially for broad topics like this (or maybe some code that shows what you're doing) - my answer up in post #2 is now looking much less helpful, as I think I overestimated how familiar you were with the command set.


Obliteration(Posted 2014) [#11]
Okay, thank you, Yasha.