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 Discussion / Set Camera FOV bug?

Author
Message
Brick Break
User Banned
Posted: 8th Jul 2009 23:41 Edited at: 9th Jul 2009 21:11
Originally, I thought there was a bug with SET CAMERA FOV. Thanks to Latch, I found it's just calculated in radians. So, to set the FOV to a certain degree measure, you would do this:

Also, you can set the FOV based on the desired lens size like this:


WINNER list:
Latch, Lee Bamber, TDK
Thanks for the help!
Brick Break
User Banned
Posted: 9th Jul 2009 05:08 Edited at: 9th Jul 2009 21:13
EDIT: Thanks again!

WINNER list:
Latch, Lee Bamber, TDK
Thanks for the help!
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 9th Jul 2009 05:14
Camera FOV

Enjoy your day.
Brick Break
User Banned
Posted: 9th Jul 2009 05:28 Edited at: 9th Jul 2009 05:31
Thank you so much! I'm adding you to my WINNER list. It's going in my sig. So, it's radians, not degrees. Sounds like Lee didn't put too much thought into that command.

EDIT: Sig'd

WINNER list:
Latch
Thanks for the help!
Zeus
17
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 9th Jul 2009 05:35
Quote: "hank you so much! I'm adding you to my WINNER list. It's going in my sig. So, it's radians, not degrees. Sounds like Lee didn't put too much thought into that command.

EDIT: Sig'd"


Oh my God, a winner list.

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 9th Jul 2009 05:59 Edited at: 9th Jul 2009 06:02
That's because it's in radians. I think 2*pi gives a full circle.
I have another language that uses radians and I made some functions to convert to and from degrees, I'll fish them out for you.

[edit]
darn it Latch!
He doesn't even have to type his answers any more haha.

TGC Forum - converting error messages into sarcasm since 2002.
Brick Break
User Banned
Posted: 9th Jul 2009 06:17
The WINNER list is only for people who respond with the right answer right away. I think Latch may very well be the new Green Gandalf.
@Obese- Don't bother, I'm using DarkBASIC atm.

WINNER list:
Latch
Thanks for the help!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 9th Jul 2009 06:19
Quote: "Sounds like Lee didn't put too much thought into that command."


More like too much explanation. Radians are more than just a confusing method for angles. By that I mean they are more versatile. 1 radian is the radius around the circle. So if the radius is 1, the arc length of 1 radian is 1 unit. If the radius were 2 the arc length would be 2 etc.

With degrees you would need to take the angle, convert it to radians, then multiply by the radius to find arc length. While there are other applications of radians, this is the only one I remember.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Brick Break
User Banned
Posted: 9th Jul 2009 06:32
@BN2- Hmm... So by using radians, how might one set the FOV given the actual size of the lens? Just curious.

WINNER list:
Latch
Thanks for the help!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 9th Jul 2009 06:37
Yeah, you could do that I suppose, though it would be the size the lens WOULD be at a specific distance, as there IS no lens size in DBC (the camera is just a point, size 0).

It would be:

FOV=Desired Lens Size/Distance from camera.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Brick Break
User Banned
Posted: 9th Jul 2009 07:40 Edited at: 9th Jul 2009 21:05
Actually, BN2, there is a size. Explanation:
The command SET CAMERA RANGE controls the minimum and maximum drawing distance. Because the default start-draw distance and the lowest possible start-draw distance is 1, and there would be no reason to increase it, that's the size of the camera. One unit.

So, how would one specify the diameter of the lens given a standard distance of 1? By your formula, that would be size/1. Does that mean that the radians for the camera FOV also happens to be the lens diameter?

EDIT: An example being SET CAMERA FOV 3 setting the lens diameter to 3?

WINNER list:
Latch, Lee Bamber, TDK
Thanks for the help!
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 9th Jul 2009 08:11 Edited at: 9th Jul 2009 08:16
I don't think 1 radian is the radius around a circle unless somthing else is meant by this.

pi radians = 180 degrees
2pi radians = 360 degrees

From the center of the screen to either edge of the screen is an angle that opens by default to about 31 degrees. A radian can be defined as a unit representing an angle where the arc between two radii from the center of the same circle equal the radius. This does not translate directly to 1 radian = fov.

What do you mean by the diameter of the lens? The distance into the 3d view is the viewing plane. Based on the screen width and height, and an angle < pi radians, you can find this distance. As the the fov angle increases to pi (or 180 degrees) the distance to the viewing plane decreases.

Quote: "The command SET CAMERA RANGE controls the minimum and maximum drawing distance"

True and not true. This controls the rendering scope. The viewing plane is the distance at which 2d pixel units = 3d coordinate units. This forms a ratio to determine how the scene is drawn as the distance from the camera to anything visible in the scene varies. That ratio creates the perspective. The camera range just sets the distance at which any of this stuff is drawn by the engine.

The short of it is, decide on an angle that you want your field of view. If you want it in terms of a lens diamter, I suppose you would start at 1 = a fov of 180 or pi radians. So your formula for lens diameter where the diameter must be > 1 becomes

pi#=3.141592654
fov#=pi#/diameter#

Enjoy your day.
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 9th Jul 2009 11:11
Perhaps I mis-stated

1 radian is the ANGLE formed from an arc length equal to the radius.

Sorry for the confusion there

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 9th Jul 2009 19:03
@ Brick Break

You should add TDK to your winners list

TheComet


Make the path of your enemies easier with Waypoint Pro!
Brick Break
User Banned
Posted: 9th Jul 2009 21:01 Edited at: 9th Jul 2009 21:04
@TheComet- I forgot about him! I think I will, even though he doesn't post much.

@Latch- Thanks once again! Three beers for latch!

WINNER list:
Latch, Lee Bamber, TDK
Thanks for the help!

Login to post a reply

Server time is: 2024-05-20 13:29:34
Your offset time is: 2024-05-20 13:29:34