Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Multi Cameras

Author
Message
mikewhl
14
Years of Service
User Offline
Joined: 19th Jul 2010
Location: Columbus,Ohio
Posted: 25th Aug 2010 23:01 Edited at: 26th Aug 2010 00:58
Say I have 2 cameras.
Camera 0 is slaved to the player object.
Camera 1 points to player target (player to target view). And is pasted onto a sprite in one of the screen corners.

How do I code to switch back and forth between them?

Thanks in advanced.
Mike

edit: "paste image" is not the right command

some cool stuff someone else said here
Teh Stone
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 25th Aug 2010 23:16
Make Camera command to make the cameras then you can do the code for position rotation and range etc. then use the command Set Current Camera to set the camera that is displayed to the screen

unsure as the command to paste to a sprite but and i havent got Db installed on this comp but i think you can use Get Image From Camera

hope i have helped
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 26th Aug 2010 00:00 Edited at: 26th Aug 2010 00:01
Quote: "then use the command Set Current Camera to set the camera that is displayed to the screen"


Most camera commands allow you to specify a camera ID. However, if you don't specify a camera ID, then the ID will be used as specified by set current camera (0 is used by default). That command has nothing to do with being drawn or not.

Instead, use set camera view CamID, Left, Top, Right, Bottom to specify the area that camera should render to. By using this command, it is possible that the rendered scene is stretched. You can resolve this using set camera aspect CamID, Aspect#, for the "normal" result, you have to use Aspect# = viewport width / viewport height.

Quote: "unsure as the command to paste to a sprite but and i havent got Db installed on this comp but i think you can use Get Image From Camera"


I don't think that command exists. You can use the command set camera to image to make a camera render to an image instead of the screen. There are some limitations for that image (for example it can't be converted to a memblock), but it can be used as a texture for a sprite or an object.

Cheers!
Sven B

mikewhl
14
Years of Service
User Offline
Joined: 19th Jul 2010
Location: Columbus,Ohio
Posted: 26th Aug 2010 00:57
Thanks guys!
I already have the know how of the camera and rendering it to a sprite (your posts have helped a lot).

Say I am viewing camera 0, hit the F2 key to switch to camera 1.
Would I need to flag one as on then switch the flag to use the other one?
Just how to word that switch is where i am stuck in my noobness.


Mike

some cool stuff someone else said here
Teh Stone
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 26th Aug 2010 01:15
Quote: "You can use the command set camera to image "


thats what i was thinkin of sorry mate

setting the camera view seems like a better solution anyway
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 26th Aug 2010 15:26 Edited at: 26th Aug 2010 15:30
I guess you could achieve that effect by using
set camera view CamID, 0, 0, 1, 1 to hide and
set camera view CamID, 0, 0, screen width(), screen height() to show.
It won't completely hide the camera, but I don't think anyone would notice that dot on the top left of your screen. You can always paste something over it though.

[edit] About what you were trying to achieve: Isn't it possible to store the coordinates and orientation of those two cameras in variables and use only one camera instead? It will be faster than using 2 cameras as well. I think that creating 2 cameras while only one will be shown on the screen at a time is very inefficient...

Cheers!
Sven B

mikewhl
14
Years of Service
User Offline
Joined: 19th Jul 2010
Location: Columbus,Ohio
Posted: 26th Aug 2010 17:09 Edited at: 26th Aug 2010 17:10
You are right about that Sven.
I am showing both at the same time. See image.
In the upper right is a 256 x 256 image from camera 1.
I want to switch cameras, where camera 0 renders to 256 image, and camera 1 is the main screen, and then back again.
Hope that makes sense.
Thanks Sven.

Mike

some cool stuff someone else said here

Attachments

Login to view attachments
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 26th Aug 2010 17:42
Here's an example using SET CAMERA TO IMAGE:



Heck, doing it that way you could even add motion blur if you wanted to


Guns, cinematics, stealth, items and more!
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 27th Aug 2010 12:11
I think your best bet is switching the camera's position and orientation, like so:



I couldn't find any command in DBP that allows you to change the drawing order of camera's. Perhaps you can render both camera's to an image each, but seeing that you have one small and one big image this might give problems in the future.

Cheers!
Sven B

Login to post a reply

Server time is: 2024-11-23 11:01:12
Your offset time is: 2024-11-23 11:01:12