Turn On GPU Instancing on Terrain Detail Prefabs

   2766   3   0
User Avatar
Member
5 posts
Joined: 10月 2021
Offline
according to the help menu:
https://www.sidefx.com/docs/unity18.0/_terrain.html#Terrain_Scatterring [www.sidefx.com]

It does not have an option to turn on the GPU instancing for the detail prefab,
I can scatter detail prefab using: "unity_hf_detail_prototype_prefab", but I cannot turn the prefab GPU instancing on and it should be on in most cases.

https://docs.unity3d.com/ScriptReference/DetailPrototype.html [docs.unity3d.com]

I checked on the Unity scripting document for terrain details. It also do not have an optional to turn on the GPU instancing. is that impossible to turn in on by default? thank you
Edited by artchapter - 2022年3月9日 07:18:31
User Avatar
Member
9 posts
Joined: 2月 2017
Offline
I would also like to know if it's possible to enable this property via Houdini. Am currently just enabling it manually every time I rebuild.
User Avatar
Member
10 posts
Joined: 5月 2023
Offline
Looks like this option was added on the Unity side in 2022.1
https://docs.unity3d.com/ScriptReference/DetailPrototype-useInstancing.html [docs.unity3d.com]

Would be nice to have this as an attribute on the Houdini side,
gave a shot at using the following

unity_hf_detail_prototype_useInstancing - Set a Primitive Integer attribute with a value or 1
or
unity_hf_detail_prototype_useInstancing - Set a Primitive String attribute with a value of true

but no dice.
User Avatar
Member
1 posts
Joined: 10月 2023
Offline
ctrl
Looks like this option was added on the Unity side in 2022.1
https://docs.unity3d.com/ScriptReference/DetailPrototype-useInstancing.html [docs.unity3d.com]

Would be nice to have this as an attribute on the Houdini side,
gave a shot at using the following

unity_hf_detail_prototype_useInstancing - Set a Primitive Integer attribute with a value or 1
or
unity_hf_detail_prototype_useInstancing - Set a Primitive String attribute with a value of true

but no dice.

you can open houdini plugins scrips in Assets/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_TerrainUtility.cs
and add the

#if UNITY_2021_3_OR_NEWER
if (detailPrototype.renderMode == DetailRenderMode.VertexLit)
{
detailPrototype.useInstancing = true;
}
#endif

below these code

detailPrototype.dryColor = heuDetail._dryColor;
detailPrototype.healthyColor = heuDetail._healthyColor;
detailPrototype.maxHeight = heuDetail._maxHeight;
detailPrototype.maxWidth = heuDetail._maxWidth;
detailPrototype.minHeight = heuDetail._minHeight;
detailPrototype.minWidth = heuDetail._minWidth;
detailPrototype.noiseSpread = heuDetail._noiseSpread;
detailPrototype.renderMode = (DetailRenderMode)heuDetail._renderMode;


more detail is here [zhuanlan.zhihu.com].
  • Quick Links