3
\$\begingroup\$

I'm developing a 3D space-based game which allows free movement in all directions and features planets. Currently I am using the Visual Studio content manager to import models (spheres) with 2D textures applied to them. These planets are supposed to be very large, which allows the player to come very close to their surfaces.

From afar, the textures look great. Up close, however, they become very blurred or pixelated (depending on whether I draw them with linear or point clamp).

I understand that I can enable mipmaps for the textures to change the level of detail shown at different draw distances, but obviously this can only be as high resolution as the texture files I provide it. The Visual studio content pipeline only allows Texture2D of size 2048x1024 or less and obviously I don't want to be holding enormous image files in memory for use in game.

Should I produce a set of higher resolution tiles of small sections of the planet's texture, load them on demand and stitch them together? How would this be achieved in XNA?

The effect I'm looking for would be similar to google maps.

It may be that in the future, I will decide that the textures being blurred or pixelated is acceptable, but since this is much a learning process for me, I'd still like to know how it would be solved.

Below is a demonstration of what I mean using a Mercator map of the Earth as an example:

Earth from far

Earth close up with linear clamp

Earth close up with point clamp

\$\endgroup\$
  • \$\begingroup\$ do you mean that when you zoom in, the detail is lower than what you would normally see if you zoom in that texture from an image editor ? \$\endgroup\$ – dimitris93 Apr 14 '15 at 18:30
  • \$\begingroup\$ I'm pretty sure he means something like texture streaming in Arma, where textures get loaded in a higher resolution the nearer you are to an object. \$\endgroup\$ – VaTTeRGeR Apr 14 '15 at 18:45
  • \$\begingroup\$ Yes, that's what I mean. I'd like to be able to keep the texture looking sharp regardless of how far/near the camera is to the planet. \$\endgroup\$ – user60130 Apr 14 '15 at 18:58
2
\$\begingroup\$

The way Google does it

The way Google Maps does it, is indeed by having multiple levels of detail. Moving through these levels, tiles will get smaller and smaller. Fitting a 2k texture on a tile that contains a full continent, will give you less detail than fitting a 2k texture on a tile that contains a small neighbourhood with only a few roads.

It is important to note than tiles get loaded, depending on what area you are looking at (your region of interest). You can't simply switch from a 2k texture to a 4k texture as the player zooms in on the planet, as you will run into memory problems very soon, due to the exponential increase in image data. Instead, you will want to draw only the segment of the sphere the player is looking at, and only load the associated textures. What is off camera should not be rendered, nor should the textures be loaded.

The problem with this approach is, that you will need an extreme amount of textures to get the fidelity Google Maps will offer you. If you want to be able to zoom in, all the way to street level, you need textures at that level (and all levels before), for all tiles across the entire planet. Google has this data via years of gathering satellite images, but it's infeasable to have this data available in a game.


A feasible way you could do it

For that reason, I think only a procedural approach is viable in this case. A procedural approach means that the planet's geometry and textures get generated on-the-fly, via some mathematical formula. Techniques for this are readily available if you do a search on "terrain generation" or "procedural planet generation". This approach let's games like Spore and Destiny generate planets with detail up to surface level.

A downside is that you have less control over what your planet will exactly look like. For example, if you want a planet that looks exactly like earth (with bodies of water, mountians, roads, etc in the same position, you will not be able to do this in a procedural way). It is however the only feasible way to "store" an entire planet in great detail. (The key is that, rather than "storing it", you are encoding it as a set of parameters, generating actual geometry and textures on-the-fly).

Something to be aware of (as Rioki pointed out), is that textures slapped onto a sphere will not cut is. At higher levels of detail, you will need to deform the geometry (for example around mountains). Techniques such as displacement mapping or tessellation will help here. Procedural methods will give you this data for free however.

In short, your question is a problem of scale. A procedural approach is a very feasible approach for planet rendering in general, but I'm not sure if it fits your use case. If your use case is to render planet earth specifically, at a level of detail Google Maps offers, I'd say that's impossible as you cannot store the amount of satellite imagery that would be needed for the textures.

\$\endgroup\$
1
\$\begingroup\$

If you want to space game where you can get close to the planets you actually need to model the planets in a significant more realistic fashion, just using one humongous texture is not going to cut it.

Now it really depends on the level of fidelity on what you want to do. But the problem with the scale of planets, when they fill your almost your entire view, a large part of it is not visible. To maintain a decent performance you need to be able to render only the relevant bits. Also you need to account for the different materials aspects, like terrain and oceans' reflectivity. Also things like atmosphere and weather play a role in the plausibility of the planet.

There are a myriad algorithms you can try, but but you may want to look at this algorithm that extends ROAM to spheres: A Real-Time Procedural Universe, Part Two: Rendering Planetary Bodies Also here is a list of research papers on this subject.

If you want an extreme illustration of the approach, you can watch this Infinity Engine Demo

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

This method will save you some resources

  1. create a sphere for your planet with a small height map, make your texture 2.5k for compact pixels
  2. add sphere with transparency + weather around the planet.

that is the best way to fudge planets for games just ask bungie

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy