HoudiniEngineForUnity icon indicating copy to clipboard operation
HoudiniEngineForUnity copied to clipboard

HDRP Terrain Detail

Open tgaldi opened this issue 3 years ago • 1 comments

The new HDRP pipeline currently only seems to support instance meshes for terrain details. The following needs to be added to HEU_TerrainUtility.ApplyDetailLayers():

#if UNITY_2021_2_OR_NEWER
            if( detailPrototype.usePrototypeMesh )
                detailPrototype.useInstancing = true;
#endif

There's also a new property on detail prototypes that will need to be added to HEU_DetailPrototype

        // Summary:
        //     Controls how far away detail objects are from the edge of the hole area.
        public float holeEdgePadding { get; set; }

tgaldi avatar Sep 13 '22 15:09 tgaldi

Unity 2022 added another method for detail scatter, which is defaults to. Since the plugin currently doesn't support setting the scatter mode, I added the following to force it to use the original mode.

#if UNITY_2021_2_OR_NEWER
        if( detailPrototype.usePrototypeMesh )
            detailPrototype.useInstancing = true;
#endif

#if UNITY_2022_2_OR_NEWER
        // #NOTE: Force instance mode until plugin supports both.
        terrainData.SetDetailScatterMode( DetailScatterMode.InstanceCountMode );
#endif

tgaldi avatar Nov 23 '22 15:11 tgaldi