[Tooltip("Rendering is performed in an area of this size away from the camera. Longer ranges provide distant visibility, but thin out the rendering resolution.")]
publicfloatrenderRange=200f;
[Range(0f, 50f)]
[Tooltip("At the edge of the rendering area, effects fade out by this percentage (of the total area size). This is to avoid them abruptly cutting off")]
publicfloatfadePercentage=10f;
[Range(1, 32)]
[Tooltip("Render range * Texels per unit = target resolution."+
"\n\nIf you were to imagine a grid, this value defines how many cells fit in one unit"+
"\n\n"+
"Lowering this value will lower the render resolution, at the cost of fine details (such as ripples)")]
publicinttexelsPerUnit=8;
[Min(MIN_RESOLUTION)]
[Tooltip("Given the other parameters, cap the maximum render resolution to this")]
publicintmaxResolution=4096;
[Tooltip("When disabled, render textures use 8-bit precision instead of 16-bit. This halves the graphics memory usage, but introduces banding artifacts.")]
publicboolhighPrecision=true;
[Space]
publicboolenableDisplacement=true;
[Tooltip("From the created displacement, create a new normal map. This is vital for lighting/shading."+
"\n\n"+
"If targeting a simple lighting setup, you can disable this")]
publicboolenableNormals=true;
[Tooltip("Render normals at half resolution. This will mainly affect how effects influence the water's reflections")]
publicboolhalfResolutionNormals;
[Tooltip("Mipmaps for render targets will be enabled. At the cost of 33% additional memory a lower resolution texture will be sampled in the distance")]
publicboolnormalMipmaps=true;
[Space]
[Tooltip("Do not execute this render feature for the scene-view camera. Helps to inspect the world while everything is rendering from the main camera's perspective")]
publicboolignoreSceneView;
[Tooltip("Do not execute this render feature for overlay cameras. Typically rendering the water on an overlay camera is not entirely possible without artifacts, but there may be cases where you'd want this render pass enabled for them.")]
publicboolignoreOverlayCameras=true;
[Tooltip("Pass on the render target and coordinates to any VFX Graph with the DynamicWaterVFX component attached. To be used for things like foam-based particles.")]
publicboolenableVFXGraphHooks=true;
/// <summary>
/// Retrieve the settings objects from the current renderer. This may be used to alter settings at runtime.
/// </summary>
/// <returns></returns>
/// <exception cref="Exception">Render feature not present</exception>
Debug.LogError($"[{this.name}] Render Graph is enabled but is not supported. Enable \"CompatibilityMode\" in your project's Graphics Settings as a workaround.");
}
#endif
}
publicoverridevoidCreate()
{
constantsPass??=newSetupConstants();
dataRenderPass??=newDataRenderPass();
normalsPass??=newDisplacementToNormalsPass();
//Note: Actually prefer to render before transparents, but this creates a recursive RenderSingleCamera call
if(!displacementNormalShader)Debug.LogError("[Stylized Water 2 Dynamic Effects: A shader is missing from the render feature, causing rendering to fail. Check the inspector",this);
#errorDynamicEffectsextensionisimportedwithouteitherthe"Stylized Water 2"assetorthecorrect"Universal Render Pipeline"versioninstalled.Willnotbefunctionaluntilthesearebothinstalledandsetup.