Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,71 @@

namespace UnityEngine.Rendering.HighDefinition
{
/// <summary>
/// Options for the mode HDRP uses to evaluate probe volumes.
/// </summary>
///<seealso cref="ShaderOptions"/>
[GenerateHLSL(PackingRules.Exact)]
public enum ProbeVolumesEvaluationModes
{
/// <summary>Disables probe volumes.</summary>
Disabled = 0,
/// <summary>Evaluates probe volumes in the light loop.</summary>
LightLoop = 1,
/// <summary>Evaluates probe volumes in the material pass.</summary>
MaterialPass = 2,
}

/// <summary>
/// Options for the method HDRP uses to encode probe volumes.
/// </summary>
///<seealso cref="ShaderOptions"/>
[GenerateHLSL(PackingRules.Exact)]
public enum ProbeVolumesEncodingModes
{
/// <summary>Uses L0 spherical harmonics to encode probe volumes.</summary>
SphericalHarmonicsL0 = 0,
/// <summary>Uses L1 spherical harmonics to encode probe volumes.</summary>
SphericalHarmonicsL1 = 1,
/// <summary>Uses L2 spherical harmonics to encode probe volumes.</summary>
SphericalHarmonicsL2 = 2
}

/// <summary>
/// Options for the mode HDRP uses for probe volume bilateral filtering.
/// </summary>
///<seealso cref="ShaderOptions"/>
[GenerateHLSL(PackingRules.Exact)]
public enum ProbeVolumesBilateralFilteringModes
{
/// <summary>Disables bilateral filtering.</summary>
Disabled = 0,
/// <summary>Bilateral filtering using validity.</summary>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is validity in this context?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's validity of each probes around the sampling point, might be behind walls and stuff like that.
Not sure to be honest, this was written by another team.
That being said those choices will probably go away too at some point so not sure how much effort we should put in there.
(This will need its own doc at some point too!)

Validity = 1,
/// <summary>Bilateral filtering using octahedral depth.</summary>
OctahedralDepth = 2
}

/// <summary>
/// Project-wide shader configuration options.
/// </summary>
/// <remarks>This enum will generate the proper shader defines.</remarks>
///<seealso cref="ShaderConfig"/>
[GenerateHLSL(PackingRules.Exact)]
public enum ShaderOptions
{
ColoredShadow = 1, // Allow to defined if colored shadow are supported in shaders or not
CameraRelativeRendering = 1, // Rendering sets the origin of the world to the position of the primary (scene view) camera
/// <summary>Supports colored shadows in shaders.</summary>
ColoredShadow = 1,
/// <summary>Uses [camera-relative rendering](../manual/Camera-Relative-Rendering.md) to enhance precision.</summary>
CameraRelativeRendering = 1,
/// <summary>Uses pre-exposition to enhance color precision.</summary>
PreExposition = 1,
PrecomputedAtmosphericAttenuation = 0, // Precomputes atmospheric attenuation for the directional light on the CPU, which makes it independent from the fragment's position, which is faster but wrong
/// <summary>Precomputes atmospheric attenuation for the directional light on the CPU. This makes it independent from the fragment's position, which increases performance but reduces accuracy.</summary>
PrecomputedAtmosphericAttenuation = 0,

/// <summary>Maximum number of views for XR.</summary>
#if ENABLE_VR
XrMaxViews = 2, // Used for single-pass rendering (with fast path in vertex shader code when forced to 2)
XrMaxViews = 2,
#else
XrMaxViews = 1,
#endif
Expand All @@ -51,32 +82,68 @@ public enum ShaderOptions
// Edit->Render Pipeline->Generate Shader Includes
// Probe Volumes feature must also be enabled inside of your HDRenderPipelineAsset.
// Also uncomment in the HDRP package all ".../Experimental/Probe Volume" menu

/// <summary>The probe volume evaluation mode.</summary>
/// <seealso cref = "ProbeVolumesEvaluationModes " />
ProbeVolumesEvaluationMode = ProbeVolumesEvaluationModes.Disabled,
/// <summary>Probe volume supports additive blending.</summary>
ProbeVolumesAdditiveBlending = 1,
/// <summary>The probe volume filtering mode.</summary>
/// <seealso cref="ProbeVolumesBilateralFilteringModes"/>
ProbeVolumesBilateralFilteringMode = ProbeVolumesBilateralFilteringModes.Validity,
/// <summary>The probe volume encoding method.</summary>
/// /// <seealso cref="ProbeVolumesEncodingModes"/>
ProbeVolumesEncodingMode = ProbeVolumesEncodingModes.SphericalHarmonicsL1,

/// <summary>Support for area lights.</summary>
AreaLights = 1,

/// <summary>Support for barn doors.</summary>
BarnDoor = 0
};

// Note: #define can't be use in include file in C# so we chose this way to configure both C# and hlsl
// Changing a value in this enum Config here require to regenerate the hlsl include and recompile C# and shaders
/// <summary>
/// Project-wide shader configuration options.
/// <remarks>This class reflects the enum. Use it in C# code to check the current configuration.</remarks>
/// </summary>
public class ShaderConfig
{
public const int k_XRMaxViewsForCBuffer = 2; // REALLY IMPORTANT! This needs to be the maximum possible XrMaxViews for any supported platform!
// this needs to be constant and not vary like XrMaxViews does as it is used to generate the cbuffer declarations
// REALLY IMPORTANT! This needs to be the maximum possible XrMaxViews for any supported platform!
// this needs to be constant and not vary like XrMaxViews does as it is used to generate the cbuffer declarations
/// <summary>Maximum number of XR views for constant buffer allocation.</summary>
public const int k_XRMaxViewsForCBuffer = 2;

/// <summary>Indicates whether to use [camera-relative rendering](../manual/Camera-Relative-Rendering.md) to enhance precision.</summary>
///<seealso cref="ShaderOptions.CameraRelativeRendering"/>
public static int s_CameraRelativeRendering = (int)ShaderOptions.CameraRelativeRendering;
/// <summary>Indicates whether to use pre-exposition to enhance color prevision.</summary>
///<seealso cref="ShaderOptions.PreExposition"/>
public static int s_PreExposition = (int)ShaderOptions.PreExposition;
/// <summary>Specifies the maximum number of views to use for XR rendering.</summary>
///<seealso cref="ShaderOptions.XrMaxViews"/>
public static int s_XrMaxViews = (int)ShaderOptions.XrMaxViews;
/// <summary>Indicates whether to precompute atmosphere attenuation for the directional light on the CPU.</summary>
///<seealso cref="ShaderOptions.PrecomputedAtmosphericAttenuation"/>
public static int s_PrecomputedAtmosphericAttenuation = (int)ShaderOptions.PrecomputedAtmosphericAttenuation;
/// <summary>Specifies the probe volume evaluation mode.</summary>
///<seealso cref="ShaderOptions.ProbeVolumesEvaluationMode"/>
public static ProbeVolumesEvaluationModes s_ProbeVolumesEvaluationMode = (ProbeVolumesEvaluationModes)ShaderOptions.ProbeVolumesEvaluationMode;
/// <summary>Indicates whether probe volumes support additive blending.</summary>
///<seealso cref="ShaderOptions.ProbeVolumesAdditiveBlending"/>
public static int s_ProbeVolumesAdditiveBlending = (int)ShaderOptions.ProbeVolumesAdditiveBlending;
/// <summary>Specifies the probe volume filtering mode.</summary>
///<seealso cref="ShaderOptions.ProbeVolumesBilateralFilteringMode"/>
public static ProbeVolumesBilateralFilteringModes s_ProbeVolumesBilateralFilteringMode = (ProbeVolumesBilateralFilteringModes)ShaderOptions.ProbeVolumesBilateralFilteringMode;
/// <summary>Specifies the probe volume encoding method.</summary>
///<seealso cref="ShaderOptions.ProbeVolumesEncodingMode"/>
public static ProbeVolumesEncodingModes s_ProbeVolumesEncodingMode = (ProbeVolumesEncodingModes)ShaderOptions.ProbeVolumesEncodingMode;
/// <summary>Indicates whether to support area lights.</summary>
///<seealso cref="ShaderOptions.AreaLights"/>
public static int s_AreaLights = (int)ShaderOptions.AreaLights;
/// <summary>Indicates whether to support barn doors.</summary>
///<seealso cref="ShaderOptions.BarnDoor"/>
public static int s_BarnDoor = (int)ShaderOptions.BarnDoor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ static HDIESImporter()
/// <param name="iesMaximumIntensity">Intensity</param>
/// <param name="light">Light used for the prefab</param>
/// <param name="ies">Texture used for the prefab</param>
/// <returns></returns>
static public void CreateRenderPipelinePrefabLight(AssetImportContext ctx, string iesFileName, bool useIESMaximumIntensity, string iesMaximumIntensityUnit, float iesMaximumIntensity, Light light, Texture ies)
{
HDLightTypeAndShape hdLightTypeAndShape = (light.type == LightType.Point) ? HDLightTypeAndShape.Point : HDLightTypeAndShape.ConeSpot;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace UnityEditor.Rendering.HighDefinition
{
public class DiffusionProfileDrawer : MaterialPropertyDrawer
class DiffusionProfileDrawer : MaterialPropertyDrawer
{
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor) => 0;

Expand All @@ -15,4 +15,4 @@ public override void OnGUI (Rect position, MaterialProperty prop, String label,
DiffusionProfileMaterialUI.OnGUI(editor, assetProperty, prop, 0, prop.displayName);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace UnityEditor.Rendering.HighDefinition.ShaderGraph
{
public enum ShaderGraphVersion
enum ShaderGraphVersion
{
Initial = 0,
FirstTimeMigration = Initial,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace UnityEngine.Rendering.HighDefinition
{
/// <summary>
/// Utility class for HDRP specific components.
/// </summary>
public static class ComponentUtility
{
/// <summary> Check if the provided camera is compatible with High-Definition Render Pipeline </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
namespace UnityEngine.Rendering.HighDefinition
{
/// <summary>
/// Utility class for debug overlay coordinates.
/// </summary>
public class DebugOverlay
{
/// <summary>Current x coordinate.</summary>
public int x { get; private set; }
/// <summary>Current y coordinate.</summary>
public int y { get; private set; }
/// <summary>Current overlay size.</summary>
public int overlaySize { get; private set; }

int m_InitialPositionX;
int m_ScreenWidth;

/// <summary>
/// Start rendering overlay.
/// </summary>
/// <param name="initialX">Initial x position.</param>
/// <param name="initialY">Initial y position.</param>
/// <param name="overlaySize">Size of overlays between 0 and 1.</param>
/// <param name="screenWidth">Width of the screen.</param>
public void StartOverlay(int initialX, int initialY, int overlaySize, int screenWidth)
{
x = initialX;
Expand All @@ -19,6 +32,9 @@ public void StartOverlay(int initialX, int initialY, int overlaySize, int screen
m_ScreenWidth = screenWidth;
}

/// <summary>
/// Increment coordinates to the next overlay.
/// </summary>
public void Next()
{
x += overlaySize;
Expand All @@ -30,6 +46,10 @@ public void Next()
}
}

/// <summary>
/// Setup the viewport for the current overlay.
/// </summary>
/// <param name="cmd">Command buffer used to setup viewport.</param>
public void SetViewport(CommandBuffer cmd)
{
cmd.SetViewport(new Rect(x, y, overlaySize, overlaySize));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace UnityEngine.Rendering.HighDefinition
[Serializable, VolumeComponentMenu("Lighting/Indirect Lighting Controller")]
public class IndirectLightingController : VolumeComponent
{
[UnityEngine.Serialization.FormerlySerializedAs("indirectDiffuseIntensity")]
/// <summary>Indirect diffuse lighting multiplier, between 0 and 1</summary>
[Serialization.FormerlySerializedAs("indirectDiffuseIntensity")]
public MinFloatParameter indirectDiffuseLightingMultiplier = new MinFloatParameter(1.0f, 0.0f);
/// <summary>Controls which layer will be affected by the indirect diffuse lighting multiplier </summary>
public LightLayerEnumParameter indirectDiffuseLightingLayers = new LightLayerEnumParameter(LightLayerEnum.Everything); // Default to everything to not have migration issue
Expand All @@ -20,8 +20,8 @@ public class IndirectLightingController : VolumeComponent
/// <summary>Controls which layer will be affected by the reflection lighting multiplier </summary>
public LightLayerEnumParameter reflectionLightingLayers = new LightLayerEnumParameter(LightLayerEnum.Everything); // Default to everything to not have migration issue

[UnityEngine.Serialization.FormerlySerializedAs("indirectSpecularIntensity")]
/// <summary>Reflection probe and Planar reflection intensity multiplier, between 0 and 1</summary>
[Serialization.FormerlySerializedAs("indirectSpecularIntensity")]
public MinFloatParameter reflectionProbeIntensityMultiplier = new MinFloatParameter(1.0f, 0.0f);

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,20 @@ internal GlobalLightingQualitySettings()
public int[] SSRMaxRaySteps = new int[s_QualitySettingCount];

// Screen Space Global Illumination
[System.NonSerialized]
/// <summary>Screen space global illumination step count for the ray marching.</summary>
[NonSerialized]
public int[] SSGIRaySteps = new int[s_QualitySettingCount];
[System.NonSerialized]
/// <summary>Screen space global illumination's world space maximal radius.</summary>
[NonSerialized]
public float[] SSGIRadius = new float[s_QualitySettingCount];
[System.NonSerialized]
/// <summary>Screen space global illumination flag to define if the effect is computed at full resolution.</summary>
[NonSerialized]
public bool[] SSGIFullResolution = new bool[s_QualitySettingCount];
[System.NonSerialized]
/// <summary>Screen space global illumination signal clamping value.</summary>
[NonSerialized]
public float[] SSGIClampValue = new float[s_QualitySettingCount];
[System.NonSerialized]
/// <summary>Screen space global illumination's filter size.</summary>
[NonSerialized]
public int[] SSGIFilterRadius = new int[s_QualitySettingCount];

// Ray Traced Ambient Occlusion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ void IDataProvider.GetShadowMask(ref RenderTexture output, StageRuntimeInterface
data.additionalCameraData.clearColorMode = oldClearMode;
}

/// <summary>
/// The HDRP implementation for the callback that the look dev raises to process any necessary cleanup.
/// </summary>
/// <param name="SRI">Access element of the LookDev's scene</param>
void IDataProvider.Cleanup(StageRuntimeInterface SRI)
{
LookDevDataForHDRP data = (LookDevDataForHDRP)SRI.SRPData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@ internal bool AddDiffusionProfile(DiffusionProfileSettings profile)
}
#endif

// Implement IVirtualTexturingEnabledRenderPipeline
/// <summary>
/// Indicates if virtual texturing is currently enabled for this render pipeline instance.
/// </summary>
public bool virtualTexturingEnabled { get { return true; } }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ public struct LightSettings
}


/// <summary>
/// Represents resolution settings for planar reflections.
/// </summary>
[Serializable]
public class PlanarReflectionAtlasResolutionScalableSetting : ScalableSetting<PlanarReflectionAtlasResolution>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace UnityEngine.Rendering.HighDefinition
{
[GenerateHLSL]
public enum PbrSkyConfig
enum PbrSkyConfig
{
// Tiny
GroundIrradianceTableSize = 256, // <N, L>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,12 @@ public static void Render(
Render(cameraSettings, cameraPositionSettings, target, staticFlags);
}

[Obsolete("Use CreateReflectionProbeRenderTarget with explicit format instead", true)]
/// <summary>
/// Create the texture used as target for a realtime reflection probe.
/// </summary>
/// <param name="cubemapSize">The cubemap size.</param>
/// <returns>The texture to use as reflection probe target.</returns>
[Obsolete("Use CreateReflectionProbeRenderTarget with explicit format instead", true)]
public static RenderTexture CreateReflectionProbeRenderTarget(int cubemapSize)
{
return new RenderTexture(cubemapSize, cubemapSize, 1, GraphicsFormat.R16G16B16A16_SFloat)
Expand Down Expand Up @@ -388,7 +388,6 @@ public static RenderTexture CreatePlanarProbeRenderTarget(int planarSize, Graphi
/// Create the depth texture used as target for a realtime planar reflection probe.
/// </summary>
/// <param name="planarSize">The size of the texture</param>
/// <param name="format">The planar probe format. It must match the format set in the asset.</param>
/// <returns>The texture used as planar reflection probe target</returns>
public static RenderTexture CreatePlanarProbeDepthRenderTarget(int planarSize)
{
Expand Down