sideeffects / HoudiniEngineForUnity

Houdini Engine for Unity
http://www.sidefx.com/unity
223 stars 85 forks source link

HDRP Terrain Detail #24

Open tgaldi opened 2 years ago

tgaldi commented 2 years ago

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 commented 1 year ago

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