Advertisement Jump to content
Sign in to follow this  
Norman Barrows

How far can you see something?

This topic is 1737 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How far can you see something?

 

I know it seems like a silly question, but...

 

i find myself asking this question often, especially when thinking about distance scales to use in a new title.  so whether its a person, a building, an airship, or a planet, how far can you see something?

 

it seems to me that there should be some pretty straightforward formula or rule of thumb approximation for:

 

given an object [sphere] of radius R, how far away must it be before it should no longer be drawn?

 

keep it generic, in d3d units.

 

so if my sphere is at: range = 1, it appears to be almost 2R wide. at some distance: range = D, it appears to be about 2R/D wide. correct?

 

so when D gets big enough that 2R/D is so small its not worth it (given screen rez etc), you should no longer draw it, correct?

 

and you could plug in your horizontal and vertical resolutions and solve for 2R/D=1 pixel (or < 1 pixel), correct?

 

does this make sense?

 

how do YOU figure out what is big enough / close enough to be drawn? 

 

 

 

 

 

Share this post


Link to post
Share on other sites
Advertisement

There is no general rule in this. Theoretically it should be worth drawing something as long as it occupies almost 1 pixel on the screen, or more of course. If it's like 0,5 of pixel width, it would blend with the background anyway.

Then there is a quesion whether the air in your game is absolutely clear or you use some fog/mist/haze.

In practical implementation, draw distances depend hugely on the game. Some important object may be worth drawing always (as long as it will be even possible to render it - as I mentioned above), maybe like for example planes in a war plane simulator?

Games commonly use draw distance clipping for better performance, because the fastest object is the one that you never draw smile.png And you often, especially in games like Skyrim, can set the distance in game settings.

Edited by Tom KQT

Share this post


Link to post
Share on other sites

In any case you should have:

view distance slider (controlling at what volume and distances an object will no longer be drawn)

detail distance slider (to control the geometry and shared quality at various distances)

Share this post


Link to post
Share on other sites

On a perfectly flat plane, you can see about 12 miles.

 

If you want to work on a physically based system, then work out what scale you are working at and calculate what 12 miles would be at that scale.

 

When you get into space the problem becomes more complex, but easy to work with. Planets and other bodies that simply reflect light will disappear at a much shorter distance than objects that emit light.

 

So stars will be visible at all distances.

 

If you want to do a more maths based solution, it's time to use trig. You can work out from your field of view and display resolution what angle of elevation maps to one pixel.

 

Say your display is 640 pixels high and you have a 45 degree field of view, then one pixel maps to 45/640 =  0.0703125  degrees

 

You can then decide how big an object you want to be visible at the horizon and then max visible range = height/tan(0.0703125)

 

It really doesn't matter how you do it, as long as you are happy with the result.

Share this post


Link to post
Share on other sites

Tom KQT makes some good points - regarding air clarity, etc. If the OP is asking about the human eye, there is more than just resolution involved. In a war plane simulation (as Tom mentioned), an observer may not notice a pixel that's only slightly different in hue than the sky, but may notice movement across the screen of such a pixel.

Share this post


Link to post
Share on other sites

how about:

 

if D > RH/W, don't draw.

 

where:

 

D is the distance from the object to the camera

R is the radius (half the width/height) of the object

H is the horizontal resolution of the screen in pixels (just considered the horizontal case so far)

W is the width of the screen.

all must be in the same units of measure.

 

using a scale of 1 meter = 1 d3d unit,

 

given an object of radius 1 meter, a screen width of 0.5 meters (being generous), and a horizontal resolution of 1600 pixels, the object would appear to be 1 pixel wide at a distance of 3200 meters. 

 

which coincidentally is the horizontal resolution times the object width. this is only because the 0.5 screen width and width=2*radius cancel each other out.

 

so for a screen width of 0.5 meters, it simplfies to:  

 

if D > 2RH dont draw

 

if course, odds of running 1600 on a 0.5 meter wide screen are slim.

 

so "if D > RH/W, don't draw" should usually be used.

 

but then you have to go around measuring the user's monitor to get W! <g>

 

you could use a default "standard" value....   "the average monitor is X meters wide"

 

or make it a menu pick, with a default value (0.4 meters?). much more better - as capn jack would say.

 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites


On a perfectly flat plane, you can see about 12 miles.

 

dues to atmospherics? limitations of the human eye? both?

 

i'm talking about theoretical pinhole camera graphics pipeline stuff.

Share this post


Link to post
Share on other sites

Curvature of the earth.

 

It's great when you are at sea and get a really clear day. You can actually see a ship on the horizon slip below it. smile.png

 

Of course most of the time all you can see is the next wave about to break over your head or the smog drifting out to sea from an oil refinery....

Share this post


Link to post
Share on other sites


Curvature of the earth.

 

i thought it was something like 6 feet in 5 miles.

 


It's great when you are at sea and get a really clear day. You can actually see a ship on the horizon slip below it. 

 

been there, like to be there again! : )

 


Of course most of the time all you can see is the next wave about to break over your head or the smog drifting out to sea from an oil refinery....

 

need a bigger boat! and clearer waters! might i recommend the Florida Keys or Chesapeake bay? well, the Bay is only ok... but yeah, Florida Keys, green water, white sand, can't bet it with a stick! Probably even nicer than the waters around Hawaii - except from a surfing point of view, of course.  Something over 30 feet (10 meters), sail or powr, your choice. probably get away with 20' (7 meters) in a power boat without getting too wet. but nothing beats the thrill of wind power on a hard keel over run with a strong wind. trust me, i know, i drive a 700 horsepower chevelle street machine.

Share this post


Link to post
Share on other sites

smile.png

 

I remembered 12 miles as the figure we used when I wrote flight simulators.

 

I've done some checking and it looks like I was out. The maths suggest that for a 6' tall man the horizon is as little as three miles away.

 

Unless he is stood on mount Everest, when it's closer to 230 miles away.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!