[Released] Vegetation Studio Pro

About biomes and multiple terrain tiles…?

If you have multiple terrain tiles - as in really big terrains (1024x512 procedurally generated terrains of 1km2), is the correct workflow to define biome stack and biome mask area in global-space (covering ALL the terrain tiles) or to setup stack and mask areas for each terrain tile…?
(Just want to make sure the workflow supports even this scenario).

A single biome area mask can be on multiple terrains.

The workflow is:

You create one vegetation package for each biome you want to make. Then add them all to the Vegetation System component.

You select one of these as default biome. This will be used on the entire terrain except for where you have other biomes.

You then create biome area masks for the areas you want biomes and assign a biome type to each mask. If you want to stack biomes you need to set the biome sort order. Higher sort order on top.

to set up a world with run-time loading or run-time generated terrains you will have to define your world when setting up the vegetation system. As an example you can define a 16x16km world. The area will be initialized at statup and you can then add and remove terrains from this area run-time.

I am working on this part and floating origin support now.

for a massive world as you are talking about you would have to split this up in multiple sub areas. 500 000 terrains and the area needed will not be possible in a single vegetation system setup. Just the internal structure would eat up your memory and you would get floating point issues with cell rects, masks and other prolems. even with a floating origin.

Lennart

1 Like

Sounds good, So another question would be what about or if* people have a long term 2017.4 game/project
and can upgrade to 2018Xf for new games/projects … would they be able to use both VS versions ? Or use VS Pro for Unity2017.4 as well ?

Hi.

I will continue development on both versions. You can use any version depending on your project.

To use VS pro (final version) you will need at lest 2018.3+. It will not be possible to port VS Pro back to older Unity versions since it is based on the new Unity tech they are adding now.

For any project needing older Unity versions the standard Vegetation Studio is they way to go.

Lennart

1 Like

Great! Sorry to be a PIA … I assume this to mean that if people bought VS for 2017.4 And pay’s for the upgrade
VS Pro for 2018 X that the will be able to use both versions for just the upgrade cost ? I assume this is correct,
want to confirm.

As I do intend to get the upgrade as well, but most or a lot of assets are still for 2017 and or 5.6X

Yes. If you bought the current version and get the new (with the upgrade price) you will have both assets and get updates to both.

Lennart

1 Like

Floating Origin

I finished the floating origin support for VS Pro tonight.
Since there is multi terrain support and terrain may be loaded/unloaded runtime the floating origin will not follow the terrains. By default the position of the VegetationSystemPro component will be used as an anchor or you can assign any transform you want it to follow.

We have a compute shader pass on all instanced indirect and a Job system culling/LOD selection pass for all instanced vegetation and can offset the instances when preparing the render info.
The same goes for the job based vegetation and billboard cell culling.

There is no extra calculation needed and close to 0 cost for moving the floating origin.

Lennart

2 Likes

This is a must. Eagerly awaiting the signup form.

Distance Falloff rule

With the prepass on both instanced and instanced indirect we can do a few more advanced rules.

There is a new Distance Falloff rule that can reduce the instance density based on the camera view. This will work for grass, plants and objects both instance and instanced indirect.

You se a minimum distance where density is 100% in this example 40% of the vegetation distance. After that the density is reduced linear towards the vegetation distance.

Lennart

2 Likes

Post processing volumes

On the Vegetation Studio Manager component there is now a tab with setting to help you set up post processing volumes. This needs the new Post Processing 2.0 from unity installed to be enabled.

You can here add multiple profiles and assign each of them to a biome type. The manager will then create a custom mesh volume based on the Biome Mask area and assign and configure a post processing volume for each of the biome areas. This can then be used to blend between profiles as the player/camera moves around the map.

You can here set the normal settings for priority, blend distance and weight that will be set on the post processing volume component when created.

Lennart

8 Likes

Terrain support

There are 3 different terrain types supported by VS Pro. These all provide the area, height sample and normal needed for the vegetation spawning rules. They all use a common interface for communication with the VegetationSystem component.

  • UnityTerrains

To add a normal Unity terrain to Vegetation Studio add the UnityTerrain component to the same GameObject as the terrain. Then drag and drop the terrain to the slot on the Terrain tab of the Vegetation System. There is also a button there that will auto configure all terrains in the scene.

  • MeshTerrains

The MeshTerrain component allows you to add multiple meshes to a virtual terrain that Vegetation System can spawn vegetation on. You can use add mesh in the scene with a mesh renderer component.

To get started create a MeshTerrainData scriptable object in the project folder and assign this to the component. This will store a BVH tree created from the added meshes and is used for sampling the terrain in the Job system.

Then add the meshes you want and generate the tree.

  • RaycastTerrains

The raycast terrain will allow you to define an area for a virtual terrain. It will use the new Raycast command jobs to sample and use any colliders on the selected layers as a terrain.

To add one or more of these terrains to the VegetationSystem component drag and drop the gameobject with the Terrain component to the Terrains tab. By default setting the terrains area will be added to the total “world” area of the vegetation system.

Lennart

5 Likes

Editor and run-time loading of terrains

Run-time adding terrains to the Vegetation System is now working. I will try to explain the 2 modes you can use for terrains.

1. Adding terrains in the editor.

To add a terrain to the vegetation system component drag and drop a terrain with one of the terrain components decripbed in the last post to the terrain tab.

By default vegetation studio is set up to automatic calulate its “world” based on the bounds of all added terrains. As you add a new terrain the internal cell structure is refreshed and the area is expanded to include that terrain also.
This is the normal way for setting up a scene with one or multiple terrains. They will all work as a combined terrain with spawning, rules, billboards etc.

2. Run-time loading terrains.
But for some scenarios you want do load areas run-time using async scene loading or another approach to load and instantiate terrains.

In order to do this you need to disable automatic calulation for the world area. In the image below I configured a 8k x 8k word for my scene.

When starting the vegetation system it will initialize the internal structure for the world area.

The UnityTerrain component now has a couple of new settings.

  • Add/remove at Enable/Disable. With this setting checked the Terrain will find the Vegetation System in the scene and add it self when the terrain is enabled. This could be when loaded or instantiated from a prefab. It will register itself with the vegetation system and update the internal cell bounds, clear cache and update the culling system for its area.
  • Apply floating origin at enabled. This setting is enabled by default. When using floating origin and a terrain is instantiated at the “offset” position it will compensate for this when setting up the terrain.

If the terrain is instantiated at “original” position and then moved to fit the current floating origin offset you should disable this on the terrain.

What setting you need depends on the way you manage your scene.

You can add the UnityTerrain component before saving the scene/prefab or add this in code when loading the terrain.

Lennart

2 Likes

So… if I understand correctly. I can dynamically generate/load terrain tiles on the fly at runtime - nice.
BUT … can I also define the biomes at runtime? Is this done with a splatmap/bitmask like MapMagic can generate - or is it done at runtime using polygon outlines, like in the editor example videos? Or can it be both?

Or would the biomes be predefined in the editor, even though the actual terrain us generated/loaded at runtime?

Hi.

For now the biomes are polygon mask areas you can create from code or using the editor tools.

I will look at adding this from a “bitmap” format also. It will need a multi channel bitmap with at least a top and bottom biome and a blend factor. Ideally also a pre computed distance to biome edge for some additional rules…
But more on that later…

You can have the biomes pre configures in the main scene and then load terrains run-time and/or the terrain scene you load could have additonal biome masks loaded with the terrain.

Lennart

So basically SDF textures for each biome channel. Thats how I define my biomes today - up to four SDF channels/biomes per terrain tile. Can this be a low res texture, or does it have to match terrain res?

the resolution should not matter. But this is not something I have started to look at yet.

The format would probably be a RGBA texture where

R(byte) = bottom biome type index (from list below)
B(byte) = top biome type
G(byte) = blend between the 2 biomes
A(byte) = distance to closest point with no top biome.

 [Serializable]
    public enum BiomeType
    {
        Default = 0,
        BorealForest = 1,
        TemperateDeciduousForest = 2,
        TropicalRainForest = 3,
        TemperateRainForest = 4,
        ScrubForest = 5,
        DeadForest = 6,
        FantasyForest = 7,
        Grassland = 8,
        Desert = 9,
        Swamp = 10,
        Tundra = 11,
        Oasis = 12,
        Underwater = 13,
        FrozenForest = 14,
        Volcano = 15,
        Biome1 = 16,
        Biome2 = 17,
        Biome3 = 18,
        Biome4 = 19,
        Biome5 = 20,
        Biome6 = 21,
        Biome7 = 22,
        Biome8 = 23
    }

Lennart

Awesome!
Seems like all my bases are covered. Just one more thing. As you commented earlier, floats dont handle really huge worlds, so could the floating origin please be a double? For my own use I use a fixed point format for all positioning info to avoid problems at the outer areas, and generate/build terrain tiles in a local floating space. I guess you need a consistent offset for your noise offset and placement routines. As long as it is a double, everything should be fine

The offset is a Vector3. This is used in both the compute shader pass and job system + billboard rendering and all the math on the GPU and in the Unity render loop is floats. I do not think storing the offset value in a double would change anything.

Lennart

The new Book Of The Dead demo is pretty impressive. Have you any plans to implement HDRP in VSP?

1 Like

When it is stable I will look at it. The last time I tested instanced indirect did not work yet and there still is no terrain shader. That is planned for 2018.3.

When that is out and they get HDRP out of preview I will see what is needed to get it working.

Lennart

4 Likes