clipboard-questionTips & Issues & Plans

These are some tips for using this asset, known issues, and future plans.

Sky/Ocean Draw Order

The sky/atmosphere and ocean are both transparent effects, so their draw order is based on the distance to the camera. However, since they're both wrapped around the planet, they have the same distance to the camera. This is an issue, because the sky should always draw on top of the ocean.

To enforce this draw order, the SgtSky component has the CameraOffset setting, which defaults to 0.1. This offset works well in most scenarios, however, for large planets like the Earth sized example below, this 0.1 offset is lost due to floating point precision issues. To fix this, an even larger offset like 1.0 is required. If your camera can fly far from the planet, then you may need an even larger value like 10.0.

circle-info

The CameraOffset will move the sky a little bit toward the camera, and change the way it looks slightly. Therefore, you shouldn't use values that are too high, especially if your planet is small.

SgtSky.CameraOffset = 0.1
SgtSky.CameraOffset = 1.0

Landscape Global Sizes

The SgtLandscapeDetail and SgtLandscapeBiome components when using Space = Global apply detail to the whole of your planet.

This detail is tiled using the GlobalSize setting. For example, if your detail layer has a GlobalSize = 1000, and your planet has a circumference of 5000, then that detail layer will tile 5 times around your planet.

Since planets can be massive, and the detail can tile with a high frequency, the detail UV coordinates need to be baked into the planet mesh. Planet Forge bakes 4 sets of UV coordinates into your planet mesh, which can be specified using the SgtSphereLandscape component's GlobalSizes setting.

circle-info

By default, GlobalSizes is X = 1 Y = 100 Z = 10,000 Z = 1,000,000

However, since there are only 4 baked UV coordinates, this means that you can't use any GlobalSize value you like for your detail layers. Indeed, the GlobalSize setting is merely a hint at the size you want the detail to appear at. The actual size will be the nearest baked UV multiplied by an integer scale.

Additionally, the GlobalSizes you specify are also just hints, because the baked UV coordinates must tile around the planet at an integer value, so if your planet has a circumference of 5000 units and you specify a GlobalSizes.w value of 6000, then it will just round to 5000.

circle-exclamation

MSAA Cracks

If you enable MSAA (Multisample anti-aliasing e.g. Anti Aliasing = 2x Multi Sampling), then cracks can appear on the planet surface.

To avoid this I recommend using a post process AA solution instead like FXAA, SMAA, TAA, etc.

Built-in render pipeline ocean reflection/refraction.

The ocean system in Planet Forge supports reflection and refraction effects. This is a screen-space effect that uses the Opaque Texture, which is a special texture that Unity renders containing the opaque objects in your scene (e.g. landscape, spaceship, etc). By default HDRP renders this every frame, and in URP you can enable this in your renderer settings. However, the built-in rendering pipeline doesn't have this feature.

Planet Forge comes with the special CameraOpaqueTextureBIRP component, which you can add to your scene's Main Camera, and it will automatically generate this opaque texture for you.

circle-info

This component only runs in the built-in render pipeline. You can still add it in your URP/HDRP projects, but it just won't do anything.

Ambient Light & Sun Color

For space scenes to look correct, the dark side of planets and other space objects must be black. To do this, you must disable ambient lighting in your scene (e.g. set it to black or 0).

Additionally, your sun's color should be white, or near white.

This makes rendering look great in space, but it makes things look wrong on the surface of a planet with atmosphere. Disabling ambient light makes the shaded parts of terrain and objects look too dark, and setting the sun color to white makes everything too bright and white during sunrise/sunset. For example, when using a white light for the sun during sunset, it looks like this:

To fix this, what we need is for there to be different ambient light and sun color settings for space, and for down on the planet. To implement this, Planet Forge comes with the SgtSkyLighter component. This component tracks your main camera, and when it goes within an atmosphere (SgtSky component), it modifies the color of the sun, as well as the ambient lighting. When combined, this makes your scenes look immersive from space, all the way down to the planet:

circle-exclamation

Sunset Reflection Thickness

When the sun is right on the horizon, the sunset reflection thins out as it approaches the sun in URP & HDRP:

While HDRP has the Light / Shape / Angular Diameter setting, this doesn't appear to change the thinning.

In the Built-In rendering pipeline, the reflection even disappears when it gets too thin:

These are all limitations of Unity's own lighting model, which I can't change.

However, I think this issue can be fixed by modifying the ocean shader to add a custom sun reflection on top that has correct angular diameter. This will be investigated in the future.

Last updated