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.

DarkBASIC Professional Discussion / Fog rendered to a camera or camera(s)

Author
Message
Daniel TGC
Retired Moderator
19
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 13th Mar 2015 16:37
Hi,

I'm creating a simple graphical demo. It's a split screen outdoor scene. When going underwater fog gets turned on. At present this means that when player A goes underwater fog gets turned on for player B.

My question is, does anyone know of a way of selecting which camera or camera's fog effects get rendered too?
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 13th Mar 2015 17:37
I believe you can use Sync Mask for this:



Example:


"Get in the Van!" - Van B
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Mar 2015 18:34
Neat.



Powered by Free Banners
Daniel TGC
Retired Moderator
19
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 14th Mar 2015 04:34
Nice thanks I'll give it ago. I was having problems but then I was typing it out to the help file which is 0x0000002 or something it was erroring messaging out!

I'll try your 2^2 methods.
Daniel TGC
Retired Moderator
19
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 14th Mar 2015 04:55
Thanks guys you put me on the right track.

This code did it.

I was expecting the camera's to be logical, camera 1 for 2 and camera 2 for 3, but instead it seems to skip from 3 to 5. That's what was throwing me off.
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 14th Mar 2015 11:09
Admittedly I need to do it your way instead of doing a calculation at each sync mask. I just did it 2^0, 2^1 etc because it's easier to tell which camera it is.

"Get in the Van!" - Van B
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 14th Mar 2015 18:24
Using bit shifting to calculate a camera mask is considerably faster than the 2^CamID method while still maintaining readability.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Mar 2015 19:08
Quote: "I was expecting the camera's to be logical"


They are. The mask bits refer to cameras in a logical () sequence, i.e. bit zero refers to camera zero, bit 1 to camera 1, and so on. So, for example, a mask of 3 (or %11 in binary) would refer to cameras 0 and 1 which I guess was your mistake. I believe you can have up to 32 cameras in DBPro, i.e. one camera for each bit in a dword/integer corresponding to cameras 0 to 31.

As another example, if you want to render just cameras 1, 2 and 4, you would use



or equivalently



or indeed



or even, as revenant chaos points out





Powered by Free Banners
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 14th Mar 2015 22:46
Oh awesome, thanks GG and revenant chaos, I didn't know this

"Get in the Van!" - Van B

Login to post a reply

Server time is: 2026-07-11 20:22:15
Your offset time is: 2026-07-11 20:22:15