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.

Dark GDK / Sync Masking multiple cameras

Author
Message
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 29th Jul 2009 10:36
Ok, Im sure that im missing something basic somewhere, but Im having trouble on figuring out how to mask multiple cameras in the way that is done in DBPro.

I know how dbSyncMask works and I have no trouble masking single camera using a bit shift like this :

dbSyncMask( 1 << CamID );

as an approximation of dbpro's :

sync mask 2^CamID

Ive tried using the pow() maths function but have had troubles with it aswell, like it seems to not be passing the correct values.

Anyway, masking single cameras I can do, its not a problem, but what I want to do is mask multiple camera...

For instance, in DBPRO, ive seen the code :

sync mask 2^Cam1ID + 2^Cam2ID

or :

mask=mask+(2^c)
followed by :
sync mask mask

What im after is how would I achieve the same thing in GDK ?
Can I add the bit shift operation(1 << CamID) together with another one like :
(1 << CamID) + (1 << Cam2ID)
or
mask = mask + (1 << Cam2ID) -- where mask is a DWORD type

Any help to get me on the right track I would be very grateful for

If it ain't broke.... DONT FIX IT !!!
Try
20
Years of Service
User Offline
Joined: 16th Aug 2004
Location:
Posted: 29th Jul 2009 12:00
Mista Wilson,
Well, I'm not sure but if you're working on bitwise operations then you could use something like this:
(1 << CamID) & (1 << Cam2ID)

I mean, we use '&' for a bitwise addition in C/C++, right...?

Hope it helps
Cheers,
-Try
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 29th Jul 2009 14:39
Thanx Try

I was thinking that it would be one of those operators, I wasnt sure which was all, whether to use & or && or | or || ... ive seen | used when combining FVF codes such as : 0x0800 | 0x000e .. but ive tried that operator with multiple cams and it doesnt work...

I really should get my act together and research the topic properly I think lol

If it ain't broke.... DONT FIX IT !!!
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 29th Jul 2009 15:12 Edited at: 29th Jul 2009 15:12
Quote: "bitwise addition"


Bitwise addition doesn't even exist

The '&' operator is bitwise AND, and will not do what you want. You need the bitwise OR '|'.


The best way to do it is the same in both DBPro and GDK (well, almost).



Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 29th Jul 2009 15:40 Edited at: 29th Jul 2009 15:41
Ok, I wrote a little program to display the cameras that are being synced by whatever value you pass it so you can check if your values are working or not...

Apparently the bitwise & was not the correct operator, it seems to work with :

DWORD msk = (1 << 2);

msk = msk + ( 1 << 3 );

will mask cameras 2 and 3 if you passed it to dbSyncMask...

Here is the program I wrote to display the mask values :



Just pass the function whatCamera the mask value that you would pass to dbSyncMask and it will displaty what will be rendered and what wont.

This example has 3 preset "tests" in it, press keys 1 2 or 3 to display the different mask values and what renders and what doesnt.

Please Note : This is based off some DBPro code that I came across when searching for "sync mask" in the forums. That user's name is : Math89

EDIT : Beat me to it diggsey lol... Thank you very much for the info, I appreciate the help very much

If it ain't broke.... DONT FIX IT !!!
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 29th Jul 2009 15:59
Also, you could do this:



Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 29th Jul 2009 16:06
Awesome Idea diggsey, I didnt even think of using a macro. Ill have a look at that for sure, that will make some of my code alot more readable

If it ain't broke.... DONT FIX IT !!!
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 6th Oct 2009 19:09
I have a question on this:

I have two cameras ( cam0 & cam1 ).
First I do dbSyncMask ( 1 << cam1 ) to sync cam1,
then preform a dbFastSync ().
Then I switch back to cam0 with dbSyncMask ( 1 << cam0 )
after which the normal dbSync () follows.

Now, the problem is that I somehow see both cameras synced together in the one screen image!
Image attached:
You can see both cameras kind of 'clipped' together. (Each of the objects exists only once in the scene but is rendered twice)

They say it's better to burn out, than it is to fade away...

Attachments

Login to view attachments
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 7th Oct 2009 07:42
Both of the camera you are using are being rendered to the screen. The syncmasking's purpose is to only render the camera/cameras that you ask it to. It doesnt actually have anything to do with where the cameras are rendering TO.

That is something that you need to setup seperately. You could set the second camera to render to an image dbSetCameraToImage() or you could use it like a "minimap" and call dbSetCameraView() to make it smaller and position it, the former will allow you to paste the image to the screen or texture it to an object, blend it in a post processing shader or whatever, the latter will still show both camera on the screen at the same time, but one will be the full window camera and the other will be like a "minimap" view(depending on the values passed to dbSetCameraView)

Also, when you say that you are calling :

dbSyncMask( 1 << cam1 );

I am assuming the "cam1" is a previously defined integer, with the correct value of the camera it represents assigned to it. So :

cam0 = 0;
cam1 = 1;

Camera 0 is the initial active camera in GDK.

If it ain't broke.... DONT FIX IT !!!

Login to post a reply

Server time is: 2024-11-20 13:29:48
Your offset time is: 2024-11-20 13:29:48