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 / Angle Split Screen Possible?

Author
Message
TheViking
13
Years of Service
User Offline
Joined: 16th Feb 2012
Location:
Posted: 18th Nov 2014 02:13
Hey all,

Just curious if anyone has ideas on how to make a splitscreen which is on an angle (temporarily)... The way I was trying was:

Made two Sprites each 1280x1024 a little bigger than the anticipated screen size... then alternate between the two each sync. One is black on one side of the angle and the other black on the other. Now, a black line appears in the middle as anticipated and wanted, but the flicker from it alternating is definitely not wanted.

I made it black on each side so that I could move the camera over to the secondary position during the switch and then have the other side covered hoping it would be quick enough to make it seem seamless. I guess a VERY poor way to do it... So, any other options to create a splitscreen on an approximately 45 degree angle. It's only for a cut-scene, so not permanent. Or can this even be accomplished and pulled off with minimal impact?

Thanks
Ortu
DBPro Master
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 18th Nov 2014 03:39
Best option is probably to write a shader that can blend the images with an alpha mask, making one final image that you can dump to the screen.

Another option might be to take each render as a texture UV mapped to a pair of triangles fixed to cover the screen, it would basically require three renders but you can sync mask and camera mask to do just the triangles on the third.

Worst option is probably to try and merge the images manually by copying pixels.

In any case you basically need to get a single final image that you can sync once to the screen in order to get rid of that flickering. Probably. Split screen isn't something I've tried before, someone else might have a better idea.

gamerboots
16
Years of Service
User Offline
Joined: 8th Dec 2008
Location: USA
Posted: 18th Nov 2014 20:22
why not make an additional camera and use the set camera view command?

--------
DBP Archive
TheViking
13
Years of Service
User Offline
Joined: 16th Feb 2012
Location:
Posted: 19th Nov 2014 01:01 Edited at: 19th Nov 2014 05:13
Doesn't the Set Camera View command only create box shaped camera boxes though?

Orto, I was hoping there would be a simpler method, since I'm not too familiar with how to do the methods you mentioned But, I guess I should have known it would be a little more complicated... unless someone else has another option...
Chris Tate
DBPro Master
16
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 19th Nov 2014 09:18
Quote: "why not make an additional camera and use the set camera view command?"


Nah, the set camera view command features no angular parameters. You would need to do a bit more than that to make it work.

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Nov 2014 01:04 Edited at: 20th Nov 2014 01:05
Why not use two camera images to texture two carefully positioned triangles?



Powered by Free Banners
TheViking
13
Years of Service
User Offline
Joined: 16th Feb 2012
Location:
Posted: 20th Nov 2014 03:14
So, would that be the set camera to image command? I have tried it, but I guess I'm not getting it quite yet. It doesn't seem to give a real image, just shades as though it isn't truly picking up the camera. Maybe it's not the right command.

Also, I noticed with two cameras active, the animations seem to run at double speed...

Sorry that I'm not fully getting this, but trying It's not CRUCIAL to the game, but it would be a nice touch to give an added comic strip style cutscene... Thanks
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Nov 2014 18:29
Quote: "It doesn't seem to give a real image, just shades as though it isn't truly picking up the camera."


Set camera to image always works fine for me. You need to sync the camera of course or your image won't be updated correctly. Here's a simplified example of how the main loop might look:



Hope that helps.



Powered by Free Banners
TheViking
13
Years of Service
User Offline
Joined: 16th Feb 2012
Location:
Posted: 21st Nov 2014 02:55
WOW, thanks GG, I guess my issue was I was trying to texture it to a plane... or just the ordering of the code... THANKS A LOT! Works perfectly. Just need to rotate the sprite that the image is pasted to and then rotate the camera to offset it, and it gives the perfect angle splitscreen!
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Nov 2014 12:38
Quote: "Just need to rotate the sprite that the image is pasted to and then rotate the camera to offset it, and it gives the perfect angle splitscreen!"


I didn't think of that particular solution. Well done. Glad you found my suggestions helpful.



Powered by Free Banners
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 22nd Nov 2014 01:31 Edited at: 22nd Nov 2014 01:38
I threw something together that might be acceptable:



This is the shader, save it as "split-camera.fx" in the same folder:


@ GG (or anyone else experienced with shaders)

Three issues:

1) I was unable to do that thing where you shift the screen quad by half a pixel. float2 ViewSize : ViewSize; was always returning {0, 0} for me for some reason.

2) Everything seems blurry, it's as if the quad's texture is being lerped. It may have something to do with 1) now that I think about it.

3) A few of the spheres are flickering. Not sure why.

I like offending people. People who get offended should be offended. -- Linus Torvalds
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Nov 2014 13:30 Edited at: 22nd Nov 2014 13:31
Quote: "1)I was unable to do that thing where you shift the screen quad by half a pixel. float2 ViewSize : ViewSize; was always returning {0, 0} for me for some reason."


Have you tried doing it manually in code, e.g. in the shader:



and in the calling program give the actual values you want:



If that works then perhaps DBPro is not setting that semantic correctly.

I usually do that sort of thing manually as above.

If the above doesn't work either, could you supply very short simple runnable snippets of the code, i.e. DBPro plus shader?



Powered by Free Banners
TheViking
13
Years of Service
User Offline
Joined: 16th Feb 2012
Location:
Posted: 23rd Nov 2014 20:40
sounds like it'd be good... for my purposes, I think the pasting to sprite and rolling camera works good as it's only for a few seconds then the camera is hidden again... but if it starts to affect the frame rate, ill definitely give it a try... THANKS ALL!!! As always, you guys are great

Login to post a reply

Server time is: 2025-05-13 07:17:31
Your offset time is: 2025-05-13 07:17:31