UnityEngine.TerrainData.SetDetailResolution C# (CSharp) Method

SetDetailResolution() public method

Set the resolution of the detail map.

public SetDetailResolution ( int detailResolution, int resolutionPerPatch ) : void
detailResolution int Specifies the number of pixels in the detail resolution map. A larger detailResolution, leads to more accurate detail object painting.
resolutionPerPatch int Specifies the size in pixels of each individually rendered detail patch. A larger number reduces draw calls, but might increase triangle count since detail patches are culled on a per batch basis. A recommended value is 16. If you use a very large detail object distance and your grass is very sparse, it makes sense to increase the value.
return void
        public void SetDetailResolution(int detailResolution, int resolutionPerPatch)
        {
            if (detailResolution < 0)
            {
                Debug.LogWarning("detailResolution must not be negative.");
                detailResolution = 0;
            }
            if ((resolutionPerPatch < kMinimumDetailResolutionPerPatch) || (resolutionPerPatch > kMaximumDetailResolutionPerPatch))
            {
                Debug.LogWarning(string.Concat(new object[] { "resolutionPerPatch is clamped to the range of [", kMinimumDetailResolutionPerPatch, ", ", kMaximumDetailResolutionPerPatch, "]." }));
                resolutionPerPatch = Math.Min(kMaximumDetailResolutionPerPatch, Math.Max(resolutionPerPatch, kMinimumDetailResolutionPerPatch));
            }
            int num = detailResolution / resolutionPerPatch;
            if (num > kMaximumDetailPatchCount)
            {
                Debug.LogWarning("Patch count (detailResolution / resolutionPerPatch) is clamped to the range of [0, " + kMaximumDetailPatchCount + "].");
                num = Math.Min(kMaximumDetailPatchCount, Math.Max(num, 0));
            }
            this.Internal_SetDetailResolution(num, resolutionPerPatch);
        }

Usage Example

コード例 #1
0
ファイル: TerrainManager.cs プロジェクト: hayio/run-human-run
 void CopyTerrainDataFromTo(TerrainData tDataFrom, ref TerrainData tDataTo)
 {
     tDataTo.SetDetailResolution(tDataFrom.detailResolution, 8);
     tDataTo.heightmapResolution = tDataFrom.heightmapResolution;
     tDataTo.alphamapResolution = tDataFrom.alphamapResolution;
     tDataTo.baseMapResolution = tDataFrom.baseMapResolution;
     tDataTo.size = tDataFrom.size;
     tDataTo.splatPrototypes = tDataFrom.splatPrototypes;
 }
All Usage Examples Of UnityEngine.TerrainData::SetDetailResolution