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 / Orthographic Camera

Author
Message
Dimension
22
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 12th Nov 2012 00:57
I was working on creating a orthographic camera by setting the field of view of the camera to 0 but when I do that I can't see the objects. Is there a reason why this happens?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Nov 2012 11:02
Quote: "Is there a reason why this happens?"


Presumably the camera can't see anything no matter how far away it is. Draw a picture and you'll see why. A small, but non-zero, field of view on the other hand enables you to fake an orthographic camera when you place the camera a long way from the scene.

However, I have a feeling someone posted some code which gives an exact orthographic camera in DBPro. It might be part of a plug-in though. It's just conceivable that you can use the Matrix1 function:



with a suitable projection matrix. That's a pure guess though.
Duke E
17
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 14th Nov 2012 02:19
Quote: "However, I have a feeling someone posted some code which gives an exact orthographic camera in DBPro. It might be part of a plug-in though."


Had it bookmarked
http://forum.thegamecreators.com/?m=forum_view&t=42592&b=6

Modifies the registers in the camera dll.
May not work with the newer versions of DBPro though?

Regards
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 14th Nov 2012 14:50
thanks Duke E. i have been looking for such thing very long ago.

Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 15th Jan 2013 01:23 Edited at: 15th Jan 2013 01:24
I prefer to tweak the camera with DBPro commands to gain an Orthographic view. I believe the other methods discussed commonly on these forums break the ability to use object selection routines. (as in, although the image you see is orthographic, the object selection routines/functions still continue to treat the scene as perspective, causing all kinds of havoc.)

Here's a snippet to compare;




So basically adjusting the Field of View, the range and the physical location of the camera will give the desired effect. I'm yet to code in camera movement with this technique though, but for a static camera it works great.

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 15th Jan 2013 20:04
There is some shader problems with FOV=1 because of very long camera distance.

*** Merry Chuckmas! ***
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 16th Jan 2013 01:29
Wow useful stuff indeed, I found that I like to simply just set the Camera Fov to 30 and it feels more real to the eye.

Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 16th Jan 2013 03:20
mr Handy, do you have some example code & shader file which shows this issue?

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 16th Jan 2013 08:58
I can't find the source now, I have only my no-reply thread about HOLES in solid objects whil shadow mapping from FOV=1 camera.

http://forum.thegamecreators.com/?m=forum_view&t=199828&b=1

*** Merry Chuckmas! ***
Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 16th Jan 2013 10:21
Whoa! That's a huge range! 1 to 1,000,000 is very large. Did you find a sweet spot, or the range where it breaks?

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 16th Jan 2013 12:19
The real range is 100K, 1M is max range. There so many bugs with that, only 20K range works properly, but with some new problems in shader... I think I'll try to hack hamera, but I am unsure if it is safe.

*** Merry Chuckmas! ***
Lukas W
22
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 16th Jan 2013 12:48
Why not use Cloggy's plugin [link], it or does it not work with what you are trying to do?

The Taffer (+TaffED)
A thief inspired game along with the mission editor (DBPro). [on hiatus]
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Jan 2013 12:52
Quote: "I can't find the source now, I have only my no-reply thread about HOLES in solid objects whil shadow mapping from FOV=1 camera."


Sounds like a z-fighting issue in the shadow map to me. I've been dealing with the same issue recently and the likely cause is that the engine is struggling to distinguish between the occluders and the occluded if the camera near and far values are very far apart. This means that you'll probably get serious precision issues when the poly depth test is done so the shadow map is sometimes recording the depth of the occluder and sometimes the occluded - the end result is that whole polys tend to flicker in and out of shadow. My solution, not fully completed yet because of various issues, was to keep the near and far values as close together and scale the shadow map values to match.
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 16th Jan 2013 13:55
Yes, I changed view range but now shader fails to write (or read?) the depth. I tried to add or substract the near value (90K) from depth but it failed. Now I had to calculate DISTANCE. That's not right at all but works. I'll try to find my test files and upload them to my thread, as it is still unlocked.

*** Merry Chuckmas! ***
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Jan 2013 15:39
Sounds very like the problems I've been having. Hopefully we'll sort something out between us.

Login to post a reply

Server time is: 2026-07-07 09:04:33
Your offset time is: 2026-07-07 09:04:33