Can someone explain the 3266*tan(size/distance) formula?

After briefly playing around with this, I’m largely convince that the entire thing makes no sense whatever. To begin, Mikey uses radians in the video example, while the linked spreadsheet uses degrees, which is already an immediate red flag that it doesn’t work at all.

Here’s are some simple tests using radians like in the video.
size: 4m distance 1m
3266*tan(4/1) = 3781.44 (Okay, I can believe this. This seems reasonable, and it’s one of the examples from the video)

size: 3m distance 1m
3266*tan(3/1) = -465.55 (and now you’ve lost me. It needs negative amounts of pixels??)

So what am I missing here about this formula? Are there situations where it just doesn’t work?

1 Like

Do you figure out how the formula or how the constant 3266 was resolved?

@Michael_Bridges This also has been brought up on the facebook site recently.

Thanks, hopefully @ben will explain the maths involved.


Hi guys,

I can try to give this a go, but I would love to hear what’s the rationale of using this with the texture sizes though.

So: my assumption is that the course talks about “retina” level quality of textures. Retina here possible refers to Apples trademark where pixel density per length unit (PPI pixels per inch or PPCM pixels per centimeter) is minimum ~300 PPI. This is so to speak a sharpness or crispiness “value”. If I have understood correctly this is the amount of pixels needed so human eye cannot distinct separate pixels.

Distance is a factor here too. Moving display closer or further away either increases or decreases the amount of density required. The original ~300 PPI was calculated by holding a device from 10 inch from your eyes. So to take the distance into account there’s another measurement called Pixel Per Degree (PPD). So for example 57 PPD means that a triangle with a height equal to the viewing distance and a top angle of one degree will have a base on the device’s screen that covers 57 pixels.

The formula of PPD is 2dr * tan(0.5 degrees) where d = distance, r = pixel density per length unit.

So with 300 PPI device held on 10 inches from the eyes: 2 * 10 * 300 * tan(0.5) = 52.4 (rounded). If 300 PPI is enough (from 10 inches) to achieve retina level resolution then the respective PPD is 52.

(if you wonder what the 57 (used in the resource excel) is, that’s the PPD of an iPhone5 = 2 x 10 x 326 * tan(0.5) = 56.89 (rounded to closest whole number)

Eventually, I am guessing that the mistake here is (like @rekov pointed out) is that course uses radians. So, example:
2 * 10 * 299 * tan(0.5 rad) = 3266.88 PPD

So the idea probably was to use this constant for max resolution when using size and distance so that the result would be best possible. But from there on I am lost. I don’t know what is tan(size/distance) either in angles or degrees. It’s looks like some sort of ratio multiplier but dunno.

I am running out of time now, hopefully this helps. I might be completely wrong too so I am merely guessing what might be going and I would love to hear what is the actual idea behind the formula.

Cheers, Jax


Hi everyone

So the rationale starts from the idea that 57 Pixels Per Degree is enough to be retina (source). For example the Moon’s angular diameter is around 0.5 degrees with the naked eye, so you’d need about 57 / 2 = 29 pixels across to get an equivalent amount of detail to what you can see with the naked eye.

In this spreadsheet you can see the working. Starting with the size of the texture, and the distance to it (any units is ok as long as they are the same), if you take the tan of the ratio you get a very good approximation of angle the texture “subtends” (explanation).

So, if your calculator is in Deg(ree) mode then the answer you get from tan is in degrees, and you simply have…

Required Pixels = 57 * tan (size / dist)

If your calculator is in Rad(ians) then you need to convert radians to degrees. A circle comprises 360 degrees, or 2π radians (about 6.3 radians). That means there are about 360 / (2π) = 57 radians per degree (1). Coincidentally this is about the same as the number of pixels per degree you need to have retina resolution, possibly not helping with the confusion!

So to get the answer when you’re using Radians mode you have

Required Pixels = 57 * 360 / 2 Pi; * tan (size / dist)
                =            3266  * tan (size / dist)

I hope this helps, I’ve asked @Michael_Bridges to annotate [the video] around 7 minutes to explain that "your calculator must be in Radians mode, otherwise use 57 * Tan ( Size / Distance)

@sampattuzzi this is what sparked our moon / eye Silicon Valley ™ moment.

Oh dear. We are silly.

Sorry, but it still is not clear.

rad 3266 * tan(4/1) = 3781.4443081537203865265603380611
deg 57 * tan(4/1) = 3.9858282807800935790145004384214
grad 57 * tan(4/1) = 3.5861360334580361618526994861489

rad 57 * tan(4/1) = 65.995813093925922238828517841237
deg 3266 * tan(4/1) = 228.38096780750501103616418301551
grad 3266 * tan(4/1) = 205.47930325042010709843713196074

How are any of those suppossed to be equivalent?

And how does 3266 * tan(3mts/1mts) = - 465.55 makes any sense ?

3266 * tan(3474/370300) = 30.6411474034 This formula only seems to work if the distance is higher than the size

The problem here is that the angle is not equal to tan(size/distance).
tan(theta) = opposite / adjacent
In this case, theta is the angle we want, opposite is the size, and distance is the adjacent., so
tan(theta) = size/distance
theta = inv tan(size/ distance)

For size/distance = 4, then the angle is inv tan(4) which is 75.963 degrees, or 1.325 radians.

Check: 360 degrees / 2*pi radians = 57,23 degrees per radian; 75.963 degrees / 57.23 degrees/radian = 1.327 radians. Inverse tan of the ratio gives us the same angle in both degrees and radians within the limits of the precision of the floating point calculation.

57 pixels / degree * 57.23 degrees / radian = 3262.11 pixels / radian.

So, in degree mode you have:57 pixels/degree * inv tan(4/1) degrees = 4329.93 pixels
In radian mode you have 3262.11 pixels / radian * inv tan (4/1) radians = 4324.96 pixels

which is pretty much equal with floating point rounding.


I came here because I didn’t understand the formula, what bothered me was:

  1. Where does that 3266 or 57 come from ?
  2. Why tan ? I could understand that it will depend on the distance and the size of the object but couldn’t wrap my head around the tan. :thinking:

After reading that post, I can understand where the 57 comes from:


But I think the tan is out of place as @teapot21 said :

If we make a dimensional analysis of the formula it doesn’t work: (

Required pixels -> Pixel
57-> Pixel / Degre
tan (x) -> no dimension (with x being an angle) [as far as I know tan is an application from angle space to number space, so the input needs to be an angle]

So if we apply 57 * tan(size/dist) we get a result in Pixel/Degree but we want something in Pixel !

+To me, tan(size/dist) doesn’t mean a thing, we need to “feed” tan some angles (degree or rad).

I didn’t get the explanation in :

Here is what I think is right, let’s begin step-by-step:

  1. I think the first example of @ben is right, we multiply the angular diameter by the PPD value and we get the Required pixel. Let’s call “angular diameter” = a ; “Required pixel” = Rp.
    The formula is : Rp = a * PPD (right dimensions , yay !)

  2. How do we determine a ?
    Let’s have a look at the wikipedia link ben linked.
    a = 2 arctan (d/2D) with d being the size and D the distance.
    The right formula should be Rp = 2 arctan (d/2D) * PPD.

  3. Can we approximate it ?
    Well we know that if x<<1 (rad) ; tan (x) ≈ x
    With our parameters it transforms into a ≈ d/D (a in rad)
    [Explanation: from wikipedia: tan(a/2) = d/2D ->approximation-> a/2 ≈ d/2D -> a ≈d/D]
    Thus Rp ≈ d/D * PPR (in radians). We kind of find the same formula but without tan.

  4. I think the legit formula is Rp = 2 arctan (d/2D) * [57 (deg) or 3266 (rad)]
    but we can approximate it by Rp ≈ d/D * 3266 if D >> d (to have a<<1)

The approximation is the best correlation I could do with the given formula. I could be wrong but as I tried to demonstrate, I don’t think we need the tan here.

If you don’t agree with me, can you please explain why the tan should be here and were it comes from ? I may have misunderstood something and I would be glad if someone could help me :slight_smile:

Cheers !

Privacy & Terms