Detail panel

Core settings of the Shader Worlds

For the rendering, we rely on virtualized GPU based geometry clipmaps, to learn more about it, understand what the vertices per patch and rings means, please check this link. We are generating and rendering the world on a set of grids centered around the viewpoint and doubling in size at each LOD, naturally preserving the amount of geometry over screen size, even at large distances.

This terrain rendering strategy has been used in AAA games such games as The Witcher 3.

World Settings and Config

By default ShaderWorld caches the evaluation of the generator at a given location in a texture. The resolution of this cache is dependent from the amount of vertices that makes your terrain various LODs, you can represent your world with 31/63/127/255/511/1023/2047 vertices.

Some recommendations, keep in mind it greatly depends on the generation draw distance:

  • 63-127 : Extremely low end device - Souldn't even be necessary

  • 255 : Low-End Smartphone

  • 511 : PC/ consoles/Smartphone - Intra Vertices Texel to 2

  • 1023-2047 : Cinematic/Movie

Witcher 3 seems to use Intra Vertices Texel to 1 and 1023 vertices per patch, which is also an option, it all depends on your amount of LODs.

At the minimum, we need to evaluate the generator at each of the vertices making those grids, but doing so would generate a very crude world representation, that we could improve by sampling in between those vertices. Doing so allow us to compute a Normal Map, a map defining the orientation of each terrain face, that is more precise than our actual geometry, adding more visual detail, while preserving a lower number of triangles.

With Clipmap cache intra vertice texel to 1, you will only precompute the height/normal of the terrain at each vertice. The more you increase ‘Clipmap cache intra vertice texel’ the more you add details in between those vertices.

To generate Height for our surface, we need to add a producer named "Height", which should be created as default. Each new producer created can access the data generated by the producer placed before itself:

  • Producer 1 can access: Heightmap, Normalmap

  • Producer 2 can access: Heightmap, Normalmap, Producer 1

Use Adaptive Topology : Allows to adjust the terrain patch rendering to better fit the topography of the terrain and avoid ‘spikes’ of the terrain landscape. This option should not be enabled for oceans, and you can select which LOD should have its topology adapting to the terrain under the "adaptive topology" array.

Spawnables

Spawnables are managed within an instanced "Biomes Manager" which exposes an array of biomes object that can be fill in by the users. Biomes object and Spawables pbject allows reusability of spawning settings for ShaderWorld spawned content. It accepts four different types: Meshes, Grass, Foliages, or Actors. ShaderWorld will convert those type to either an instanced mesh, or an actor, using the provided object as a reference for the initial spawning parameters and which static meshes to use.

  • Meshes : you provide one or multiple Static Meshes

  • Grass : you provide a Landscape Grass Type

  • Foliages: you provide one or multiple Static Mesh Foliage

  • Actors: you provide one or multiple Actors

Each Spawnable will be computed on a set of grids dynamically placed around the players: Number of Grid Rings let you know how many rings of grid will be computed around the player, the less number of grids there is, the less draw calls will be generated, everything being computed on GPU. The number of grid rings, is automatically defined given the Cull Distance maximum value:

How far you want to see meshes defines how far you will compute them.

By default spawnables will use the material M_SpawnDensity_Default to generate a density map defining the probability for an asset to spawn.

Those density generator material can access all the generated layers, and decide if a mesh should be generated or not at a generated location, by outputing a density between 0.0-1.0, stored in the blue channel, while Red and Green channels store the XY coordinates.

If you want to add custom logic to a given spawnable, you can override the default density generator material at two levels: the Biom level, every spawnable within a Biom, will use the Biom density generator material if provided. And at the Spawnable level, each spawnable can have its own density generator material.

As spawnables are computed by drawing materials, you can define a specific draw call budget for computing spawnables, which represent how many draw calls will be allowed per frame to compute spawnables, each grid represents one draw call. Priority order for spawnables computation depends on view distance (Objects close to camera first), collision status (collision enabled first), and being within view frustum or not.

No Popping Range Meters, Spawnables improve their spawning location as you get closer to them: As the landscape ground quality improves as you get closer, spawnables locations are re-evaluated to leverage the higher quality terrain information computed.

One possible issue is that the higher quality terrain information might indicate that the terrain which seemed suitable once evaluated at lower quality is actually not suitable for spawning an asset (the ground slope is beyond the tolerated range for instance) the instance should then be removed (or the terrain is suitable and it should now spawn). As it looks jarring seeing asset spawning/despawning next to the camera, you have the option to prevent it from happening within a specific range.

Default value is 750 meters, if you want determistic results, in a multiplayer game for instance, you should set this value to 0.

Collecting resources: By default spawnables with collision enabled also have the possibility to be collected if Resource Collectable is checked and a non-empty Resource Name is provided, one of the demo maps showcases how to collect large rocks. Note that there is no book-keeping of those spawnables, nor server authoritative management of resources, if the player goes beyond the generation range and comes back, the resource will reappear. A bit like No Man’s Sky procedural collectable vegetation.

Painting foliage (UE5 Only) : If your world generates collision, you can use the Foliage Mode of Unreal Engine 5 to paint and place foliage on your Shader World terrain, as long as BSP is selected as target, and within the range you’re computing collision for.

World Collision

Similar to spawnables computation, collisions are computed in grids around the players. Collision Resolution defines the distance between two adjacent vertices for your collision meshes. Collision vertices per patch defines the size of the grid mesh patches you will be computing collisions for. You can visualize the collision mesh by toggling Collision Visible.

Export Physical Material ID, allows to specify that the ground material IDs are available within one of your terrain runtime layers, and to specify in which channel (Red, Green or Blue). By exporting those IDs you’ll be able to identify which material you are hitting during collision events, line traces etc.. Allowing you to generate appropriate sounds and VFX for a given ground material. (Water splashes when walking on a puddle,...)

Advanced | Height Scaling (Ocean)

Within our generated heightmap, we have a vertical precision of 1cm, which might not be enough for water and ocean simulations.

To store height variations with a finer precision than 1cm, we can amplify the generated height at the end of our generator material by multiplying the generated height by this factor, and mentionning to the ShaderWorld that we amplified the height by this given number.

Advanced | Dependencies

Allows one ShaderWorld to send its data to another, see Map_Ocean: the landscape ShaderWorld sends its height information to the ocean, allowing the ocean to create more interesting shoreline shading and adjust ocean transparency around the shore.

The Landscape ShaderWorld set the Ocean ShaderWorld as a Receiver. The Ocean ShaderWorld set the Landscape ShaderWorld as a Source.

The Ocean ShaderWorld can then access Landscape data using the MF_ExternalCacheRead material function inside its ocean material, allowing to fade the wave generation near shores, and adjust the color blending

(ocean world read heightmap from landscape world in its material for shore blend)

Last updated