0
\$\begingroup\$

For the game I am making, I have textures for planets. Each texture has a size of 2048 x 1024 pixels. I also know the size, thus the diameter, of each planet. Not every planet is the same size, you know.

What is the size in kilometers of one pixel?

I know it has to do with the circumference - but I'm not sure this translates into a scale.

For example, let's say a planet is 18,872 km in size, so it's a circumference of about 59258,08 km (diameter * PI).

Can anyone provide pointers in the right direction?

\$\endgroup\$
5
  • \$\begingroup\$ Do you mean a pixel on your texture or a pixel on the screen? \$\endgroup\$ Commented Oct 1, 2015 at 13:18
  • \$\begingroup\$ Pixel in the texture. \$\endgroup\$ Commented Oct 1, 2015 at 13:20
  • \$\begingroup\$ I think you'll have to edit your question to explain how you map your texture on your sphere. It's not a linear scale as the more you go toward the poles, the more pixels there are in a single km^2. Also, maybe you could tell us why you need this, this could allow us to better help you! \$\endgroup\$ Commented Oct 1, 2015 at 13:24
  • \$\begingroup\$ It's my first post here... I do apologize if it wasn't clear enough. I'll try to be more descriptive next time. Simply put, I need to know how many km there are in a pixel to zoom into an area and create topology data. \$\endgroup\$ Commented Oct 1, 2015 at 14:00
  • \$\begingroup\$ No worries! You should edit your question and make it more detailed. Comments are great, but the questions and answers are basically what we like to be the best as possible! \$\endgroup\$ Commented Oct 1, 2015 at 14:06

2 Answers 2

0
\$\begingroup\$

That depends entirely on your projection and on what pixel you are talking about.

For example, with the Mercator projection (i.e., mapping the texture to a cylinder, which is a common way of UV mapping a sphere for this) the projection depends on the latitude you are sampling at.

It would simply be a case of finding the radius and multiplying it with 2*pi to get the circumference of a circle at that latitude, and dividing it by the amount of pixels.

For example, earth has a radius of about 6.371 kilometers, for a circumference of 40030 kilometers. Giving 20 kilometers per pixel. However going towards the poles this quickly decreases (less kilometers for a given pixels, so more detail) causing the distortion we're all familiar with when looking at a regular map.

\$\endgroup\$
0
\$\begingroup\$

It obviously depends on how you wrap the texture around the planet, but let's assume that those 2048 pixels precisely cover the entire equator of your planet.

Indeed the circumference equals (pi* diameter). Divide that circumference by the amount of pixels (2048) and you have the length of your pixel. in this case:

18,872*Pi = 59288km

59288/2048 = 28.95km/px

Note however, that this only applies to the equator. Assuming you're simply wrapping the texture around the equator, the width of the pixel will get smaller the closer you get to the pole. That's because the circumference you should be using in the calculation is no longer the equator, but the slice of the sphere you're measuring.

\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.