void ProcessSatelliteMap() { if (!terrainData) { return; } var satellitemap = prettifier.satellite; if (!satellitemap) { return; } satellitemapBuffer.Check(satellitemap, RenderTextureFormat.ARGB32, false, true); // Initial blit Graphics.Blit(satellitemap, satellitemapBuffer.color); if (prettifier.satelliteProcessorEnabled) { if (prettifier.shadowRemoval.enabled) { material.SetVectorArray("_RandomDirections", randomDirections); material.SetFloat("_LumThreshold", prettifier.shadowRemoval.luminanceThreshold); material.SetFloat("_SatThreshold", prettifier.shadowRemoval.saturationThreshold); material.SetFloat("_Edge", prettifier.shadowRemoval.edge); material.SetFloat("_Radius", prettifier.shadowRemoval.radius); for (int i = 0; i < prettifier.shadowRemoval.passes; i++) { material.SetTexture("_MainTex", satellitemapBuffer.color); material.SetInt("_Pass", i); satellitemapBuffer.Blit(material, SHADER_PASS_SHADOW_REMOVAL); } } if (prettifier.cavityFilter.enabled) { SetMaterialParameters(material, heightmapBuffer.color ? heightmapBuffer.color : terrainData.heightmapTexture); material.SetFloat("_CavityIntensity", prettifier.cavityFilter.intensity); material.SetFloat("_CavityRadius", prettifier.cavityFilter.radius); satellitemapBuffer.Blit(material, SHADER_PASS_CAVITY_GENERATOR); } } }
void ProcessHeightmap() { if (!terrainData) { return; } var heightmap = terrainData.heightmapTexture; heightmapBuffer.Check(heightmap); // Initial blit Graphics.Blit(heightmap, heightmapBuffer.color); if (prettifier.heightmapProcessorEnabled) { // Bilateral smoothing if (prettifier.denoiser.enabled) { for (int i = 0; i < Mathf.CeilToInt(prettifier.denoiser.strength); i++) { SetMaterialParameters(material, heightmapBuffer.color); material.SetFloat("_DenoiseStrength", Mathf.Clamp01(prettifier.denoiser.strength - i)); heightmapBuffer.Blit(material, SHADER_PASS_DENOISE); } } // Ridge maker if (prettifier.ridgeMaker.enabled) { SetMaterialParameters(material, heightmapBuffer.color); heightmapBuffer.Blit(material, SHADER_PASS_RIDGEMAKER); } // Erosion if (prettifier.erosion.enabled) { SetMaterialParameters(material, heightmapBuffer.color); heightmapBuffer.Blit(material, SHADER_PASS_EROSION); } } }