Ivan Iliev

pungerart

About Me

Connect

LOCATION
Not Specified
WEBSITE

Houdini Skills

Availability

Not Specified

Recent Forum Posts

Scattering Trees and Details on Unity Terrain June 23, 2021, 11:06 a.m.

Hi,

I am learning to build terrains for a student project. I have trouble understanding the part of documentation regarding scattering objects with detailed layers. I successfully scattered trees and gave them random scale, rotation, etc. I have a nice texture and terrain layers, but I can not find any tutorial regarding this specific topic and I am not understanding well the highlighted section(by me) of the quote from the documentation. I am a beginner so I hope my question is not inappropriate. I would be thankful if somone create test network like the 1st here regarding tree protoypes.
papsphilip
What if its not a heightfield but a regular mesh?
it doesnt seem to work for me! Is there some attribute that is missing?
-For regular mesh you should use unity_instance attribute. unity_hf_tree_prototype could be used only on higfield/terrain.



Thank you!


Detail Layers
For smaller sized environment details such as grass, shrubs, etc., height field layers can be specified to be converted to Unity terrain's detail layers for efficient drawing.

A Unity terrain detail layer contains a map of integer values that specify the number of instances for the area covered by each value in the height field. These values must be integers between 0 and 16, so the float values from the height field will be simply converted to integers as they are. For a point in the height field, a value of 0 denotes no instances, while values between 1 and 16 denote the number of desired instances for the area covered by the height point. The area covered by each height point is determined by dividing the terrain size by the Detail Resolution, which is inferred from the size of the height field layer. For example, a terrain of size 1024x1024 with the Detail Resolution of 256 means that for each height point in a detail layer, it covers a 4x4 area.

Note that the Detail Resolution cannot be set via attribute. It is inferred from the detail layer's size, which must be a square size between 0 and 4048, as required by Unity. Therefore all specified detail layers must be of the same size.

In order to use detail layers, the height field network requires setting detail properties, as described below.

Detail Layer Properties:
The height field layer to be converted to detail layer must be marked as detail type. This is done by setting a Primitive String attribute named unity_hf_layer_type on the layer with the value detail.
On the same heigthfield layer, a DetailPrototype must also be specified via the following attributes:
To use a prefab, set a Primitive String attribute named unity_hf_detail_prototype_prefab on the layer with the path to the prefab or mesh to instantiate, relative to Assets/.
Or to use a texture, set a Primitive String attribute named unity_hf_detail_prototype_texture on the layer with the path to the texture, relative to Assets/.

Optionally:
unity_hf_detail_prototype_bendfactor - Set a Primitive Float attribute with a bend factor value.
unity_hf_detail_prototype_drycolor - Set a Primitive Color (4 float) attribute with dry color value.
unity_hf_detail_prototype_healthycolor - Set a Primitive Color (4 float) attribute with healthy color value.
unity_hf_detail_prototype_maxheight - Set a Primitive Float attribute with maximum height value.
unity_hf_detail_prototype_maxwidth - Set a Primitive Float attribute with maximum width value.
unity_hf_detail_prototype_minheight - Set a Primitive Float attribute with minimum height value.
unity_hf_detail_prototype_minwidth - Set a Primitive Float attribute with minimum width value.
unity_hf_detail_prototype_noisespread - Set a Primitive Float attribute with a noise spread value.
unity_hf_detail_prototype_rendermode - Set a Primitive Integer attribute with a DetailRenderMode value of 0 for GrassBillboard, 1 for VertexLit, and 2 for Grass (Default).
Global Detail Properties:
On the height layer, the following attributes can be specified to set the detail values for the generated TerrainData:
unity_hf_detail_distance - Set a Detail Integer attribute with value from 0 to 250 for Detail Distance.
unity_hf_detail_density - Set a Detail Float attribute with value from 0 to 1 for Detail Density.
unity_hf_detail_resolution_patch - Set a Detail Integer attribute with value from 8 to 128 for Density Resolution Per Patch.