Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x.x] Merge 8.x.x/hd/staging #1183

Merged
merged 51 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
937e9c1
[10.x.x] Axf: add normal gradients and all mapping modes (uv, planar,…
slunity Jun 12, 2020
d094c5a
[10.x.x] Axf fix shininess exp to roughness, ssr transparent and alph…
slunity Jun 12, 2020
5f86be4
Update Light-Component.md (#682)
JordanL8 Jun 6, 2020
16f7161
push meta
sebastienlagarde Jul 7, 2020
7baef35
removed undesired change in AXF
sebastienlagarde Jul 7, 2020
fb33c79
Fix transparent movec scene view #698
FrancescoC-unity Jun 2, 2020
4ce96aa
Porting console fixes to staging (#699)
FrancescoC-unity Jun 4, 2020
fda10a8
Update HDRP-Camera.md (#706)
JordanL8 Jun 6, 2020
dbad64a
Pre warm RT Handle system so that reallocations are reduced. #713
FrancescoC-unity Jun 6, 2020
80ed29a
Update PlanarReflectionProbeCache.cs
sebastienlagarde Jul 7, 2020
cc93c2d
Update preview naming in raytrace component #753
sebastienlagarde Jun 7, 2020
644061c
Workaround for GetKernelThreadGroupSizes returning wrong data #760
FrancescoC-unity Jun 9, 2020
81f925d
Sanitize transparent motion vectors setting #761
adrien-de-tocqueville Jun 9, 2020
51ea72a
Standard terrain upgrader (#762)
remi-chapelain Jun 9, 2020
aedd7ba
Update Reflection-Probe (#790)
JordanL8 Jun 9, 2020
c8e4097
Fix reflection probe framesettings override #796
adrien-de-tocqueville Jun 10, 2020
88bde23
Force post process parent setting to be before child settings #799
FrancescoC-unity Jun 9, 2020
320605e
Fixed 1253367 by rebaking probe with missing baked texture. #818
fredericv-unity3d Jun 21, 2020
f23a6f7
Fix issue with blocky artifacts when decals affecting metallic are ap…
FrancescoC-unity Jun 10, 2020
b948613
Fixed blend distance editing (1248931) #838
fredericv-unity3d Jun 12, 2020
4fc7521
Fix API breaking change: Add Public quality to Raytracing volume effect
sebastienlagarde Jul 7, 2020
f8fc08a
Fix API breaking change: Add Public quality to Raytracing volume effe…
sebastienlagarde Jul 7, 2020
e4260ec
Merge branch '8.x.x/release' into 8.x.x/hd/staging
sebastienlagarde Jul 7, 2020
02f56c7
Update HDR information. Also updated format and links. (#853)
JordanL8 Jun 11, 2020
8c920f4
Fix message for metal and ao (#859)
sebastienlagarde Jun 11, 2020
0e04f76
d Fix issue with the blue line of prefab modifications for Volume mod…
FrancescoC-unity Jun 11, 2020
9de5cb2
Recompute FOV when generating PixelCoord To WorldSpace View Direction…
FrancescoC-unity Jun 11, 2020
08b7f9e
Upgrade default legacy terrain to HDRP default TerrainLit (#883)
remi-chapelain Jun 12, 2020
8f01531
Editing volumes via script doc (#884)
JordanL8 Jun 15, 2020
f4e391d
Update HDRenderPipeline.cs (#994)
sebastienlagarde Jun 19, 2020
bf89377
Delete 9713_VirtualTexturing.meta
sebastienlagarde Jun 19, 2020
3b7f7fb
Fix SSAO with double sided material and normal mode to none #1043
FrancescoC-unity Jul 3, 2020
deacc88
Fix emissive mesh layer mask behaviour #1062
FrancescoC-unity Jul 2, 2020
e5e102f
Use the wide mode to force the UI drawing on a single line (1251235) …
fredericv-unity3d Jul 3, 2020
805e51c
Fix custom pass after post process buffer #1072
sebastienlagarde Jul 7, 2020
c9574da
Fix for area light baked data not updating when changing the gizmo #1075
FrancescoC-unity Jul 4, 2020
3d88d6b
Fixed an error when switch area light shape to disk while an emissiv…
fredericv-unity3d Jul 3, 2020
bf6e812
Have the PBR Sky not render black when below horizon #1116
FrancescoC-unity Jul 3, 2020
cc8ba57
Find the appropriate default frame settings per editor (case 1247631)…
fredericv-unity3d Jul 3, 2020
c122273
Fix taaFrameIndex and restore TAA tests for XR #534
fabien-unity May 18, 2020
2a79682
fix typo in the Render Pipeline Wizard #1037
fabien-unity Jun 29, 2020
cb7e9ad
Add light layer on indirect lighting controller #777
EvgeniiG Jun 16, 2020
3a00afa
[8.x.x Backport] Fix exposure white flash when enabling SSR (#842)
FrancescoC-unity Jul 7, 2020
ffdc83e
[8.x.x Backport] Fix transparent/opaque motion vector inconsistencies…
FrancescoC-unity Jul 7, 2020
4ab3b4f
[8.x.x Backport] Fix depth pyramid issues with dynamic resolution (#847)
FrancescoC-unity Jul 7, 2020
c87a238
[Backport 8.x.x] Fixed a serialization issue, preventing quality leve…
JulienIgnace-Unity Jul 7, 2020
5719763
[Backport 8.x.x] Fixed Look Dev with Light Theme (#1106)
JulienIgnace-Unity Jul 7, 2020
da56fbd
[Backport 8.x.x] Fixed decal duplication when editing a prefab in con…
JulienIgnace-Unity Jul 7, 2020
04ad6e9
Fix API breaking change in indirect controller
sebastienlagarde Jul 7, 2020
40cd33b
Fix area light gizmo not updating engine side light v2 #1156
FrancescoC-unity Jul 6, 2020
50e94b4
Merge branch '8.x.x/release' into 8.x.x/hd/staging
sebastienlagarde Jul 7, 2020
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
Prev Previous commit
Next Next commit
Add light layer on indirect lighting controller #777
  • Loading branch information
EvgeniiG authored and sebastienlagarde committed Jul 7, 2020
commit cb7e9add48033d0d0abdf66c80c7b2efe0f69137
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added support for AxF measurements importing into texture resources tilings.
- Added Layer parameter on Area Light to modify Layer of generated Emissive Mesh
- Added support for multiple mapping modes in AxF.
- Add support of lightlayers on indirect lighting controller

### Fixed
- Fixed issue with reflection probes in realtime time mode with OnEnable baking having wrong lighting with sky set to dynamic (case 1238047).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ The **Indirect Lighting Controller** uses the [Volume](Volumes.html) framework,

| Property | Description |
| ------------------------------- | ------------------------------------------------------------ |
| **Indirect Diffuse Intensity** | A multiplier for baked and realtime Global Illumination lightmaps and Light Probes. HDRP multiplies the lightmap and Light Probe data by this value. |
| **Indirect Specular Intensity** | A multiplier for baked, realtime, and custom Reflection Probes. HDRP multiplies the Reflection Probe data by this value. |


| **Indirect Diffuse Lighting Multiplier** | A multiplier for lightmaps, Light Probes, Light Probe Volumes, Screen-Space Global Illumination, and [Ray-Traced Global Illumination](Ray-Traced-Global-Illumination.md). HDRP multiplies the light data from all of these by this value. |
| **Indirect Diffuse Lighting Layers** | Specifies the [Light Layers](Light-Layers.md) for indirect diffuse lighting. If you enable Light Layers, you can use them to decouple Meshes in your Scene from the above multiplier. |
| **Reflection Lighting Multiplier** | A multiplier for baked, realtime, custom [Reflection Probes](Reflection-Probe.md) and [Planar Probes](Planar-Reflection-Probe.md), [Screen-Space Reflection](Override-Screen-Space-Reflection.md), [Ray-Traced Reflection](Ray-Traced-Reflections.md), and Sky Reflection. HDRP multiplies the light data from all of these by this value. |
| **Reflection Lighting Layers** | LSpecifies the [Light Layers](Light-Layers.md) for reflection lighting. If you enable Light Layers, you can use them to decouple Meshes in your Scene from the above multiplier. |
| **Reflection Probe Intensity Multiplier** | A multiplier for baked, realtime, and custom [Reflection Probes](Reflection-Probe.md) and [Planar Probes](Planar-Reflection-Probe.md). HDRP multiplies the Reflection Probe data by this value. |

## Details

Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,47 @@
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Rendering;

namespace UnityEditor.Rendering.HighDefinition
{
[CanEditMultipleObjects]
[VolumeComponentEditor(typeof(IndirectLightingController))]
class IndirectLightingControllerEditor : VolumeComponentEditor
{
SerializedDataParameter m_IndirectDiffuseIntensity;
SerializedDataParameter m_IndirectSpecularIntensity;
SerializedDataParameter m_IndirectDiffuseLightingMultiplier;
SerializedDataParameter m_IndirectDiffuseLightingLayers;

SerializedDataParameter m_ReflectionLightingMultiplier;
SerializedDataParameter m_ReflectionLightingLayers;

SerializedDataParameter m_ReflectionProbeIntensityMultiplier;

public override void OnEnable()
{
var o = new PropertyFetcher<IndirectLightingController>(serializedObject);

m_IndirectSpecularIntensity = Unpack(o.Find(x => x.indirectSpecularIntensity));
m_IndirectDiffuseIntensity = Unpack(o.Find(x => x.indirectDiffuseIntensity));
m_IndirectDiffuseLightingMultiplier = Unpack(o.Find(x => x.indirectDiffuseLightingMultiplier));
m_IndirectDiffuseLightingLayers = Unpack(o.Find(x => x.indirectDiffuseLightingLayers));

m_ReflectionLightingMultiplier = Unpack(o.Find(x => x.reflectionLightingMultiplier));
m_ReflectionLightingLayers = Unpack(o.Find(x => x.reflectionLightingLayers));

m_ReflectionProbeIntensityMultiplier = Unpack(o.Find(x => x.reflectionProbeIntensityMultiplier));
}

public override void OnInspectorGUI()
{
PropertyField(m_IndirectDiffuseIntensity, EditorGUIUtility.TrTextContent("Indirect Diffuse Intensity", "Sets the multiplier for baked diffuse lighting."));
PropertyField(m_IndirectSpecularIntensity, EditorGUIUtility.TrTextContent("Indirect Specular Intensity", "Sets the multiplier for reflected specular lighting."));
PropertyField(m_IndirectDiffuseLightingMultiplier, EditorGUIUtility.TrTextContent("Indirect Diffuse Lighting Multiplier", "Sets the multiplier for indirect diffuse lighting.\nIt affect Ambient Probe, Light Probes, Lightmaps, Light Probe Volumes, Screen Space Global Illumination, Raytrace Global Illumination."));
GUI.enabled = HDUtils.hdrpSettings.supportLightLayers;
PropertyField(m_IndirectDiffuseLightingLayers, EditorGUIUtility.TrTextContent("Indirect Diffuse Lighting Layers", "Sets the light layer mask for indirect diffuse lighting. Only matching RenderingLayers on Mesh will get affected by the multiplier."));
GUI.enabled = true;

PropertyField(m_ReflectionLightingMultiplier, EditorGUIUtility.TrTextContent("Reflection Lighting Multiplier", "Sets the multiplier for reflected specular lighting.\nIt affect Sky Reflection, Reflection Probes, Planar Probes, Screen Space Reflection, Raytrace Reflection."));
GUI.enabled = HDUtils.hdrpSettings.supportLightLayers;
PropertyField(m_ReflectionLightingLayers, EditorGUIUtility.TrTextContent("Reflection Lighting Layers", "Sets the light layer mask for reflected specular lighting. Only matching RenderingLayers on Mesh will get affected by the multiplier."));
GUI.enabled = true;

PropertyField(m_ReflectionProbeIntensityMultiplier, EditorGUIUtility.TrTextContent("Reflection/Planar Probe Intensity Multiplier", "Sets the intensity multiplier for Reflection/Planar Probes."));
}
}
}
8 changes: 8 additions & 0 deletions com.unity.render-pipelines.high-definition/Editor/Wizard.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;

namespace UnityEngine.Rendering.HighDefinition
{
Expand All @@ -8,9 +9,54 @@ namespace UnityEngine.Rendering.HighDefinition
[Serializable, VolumeComponentMenu("Lighting/Indirect Lighting Controller")]
public class IndirectLightingController : VolumeComponent
{
/// <summary>Indirect specular intensity multiplier, between 0 and 1</summary>
public MinFloatParameter indirectSpecularIntensity = new MinFloatParameter(1.0f, 0.0f);
/// <summary>Indirect diffuse intensity multiplier, between 0 and 1</summary>
public MinFloatParameter indirectDiffuseIntensity = new MinFloatParameter(1.0f, 0.0f);
[UnityEngine.Serialization.FormerlySerializedAs("indirectDiffuseIntensity")]
/// <summary>Indirect diffuse lighting multiplier, between 0 and 1</summary>
public MinFloatParameter indirectDiffuseLightingMultiplier = new MinFloatParameter(1.0f, 0.0f);
/// Controls which layer will be affected by the indirect diffuse lighting multiplier
public LightLayerEnumParameter indirectDiffuseLightingLayers = new LightLayerEnumParameter(LightLayerEnum.LightLayerDefault);

/// <summary>Reflection lighting multiplier, between 0 and 1</summary>
public MinFloatParameter reflectionLightingMultiplier = new MinFloatParameter(1.0f, 0.0f);
/// Controls which layer will be affected by the reflection lighting multiplier
public LightLayerEnumParameter reflectionLightingLayers = new LightLayerEnumParameter(LightLayerEnum.LightLayerDefault);

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

/// <summary>
/// Returns a mask of reflection lighting layers as uint and handle the case of Everything as being 0xFF and not -1
/// </summary>
/// <returns></returns>
public uint GetReflectionLightingLayers()
{
int value = (int)reflectionLightingLayers.GetValue<LightLayerEnum>();
return value < 0 ? (uint)LightLayerEnum.Everything : (uint)value;
}

/// <summary>
/// Returns a mask of indirect diffuse lighting layers as uint and handle the case of Everything as being 0xFF and not -1
/// </summary>
/// <returns></returns>
public uint GetIndirectDiffuseLightingLayers()
{
int value = (int)indirectDiffuseLightingLayers.GetValue<LightLayerEnum>();
return value < 0 ? (uint)LightLayerEnum.Everything : (uint)value;
}

/// <summary>
/// Sky Ambient Mode volume parameter.
/// </summary>
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class LightLayerEnumParameter : VolumeParameter<LightLayerEnum>
{
/// <summary>
/// Light Layer Enum parameterconstructor.
/// </summary>
/// <param name="value">Light Layer Enum parameter.</param>
/// <param name="overrideState">Initial override value.</param>
public LightLayerEnumParameter(LightLayerEnum value, bool overrideState = false)
: base(value, overrideState) { }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1816,7 +1816,7 @@ internal bool GetEnvLightData(CommandBuffer cmd, HDCamera hdCamera, in Processed
envLightData.lightLayers = hdCamera.frameSettings.IsEnabled(FrameSettingsField.LightLayers) ? probe.lightLayersAsUInt : uint.MaxValue;
envLightData.influenceShapeType = influence.envShape;
envLightData.weight = processedProbe.weight;
envLightData.multiplier = probe.multiplier * m_indirectLightingController.indirectSpecularIntensity.value;
envLightData.multiplier = probe.multiplier * m_indirectLightingController.reflectionProbeIntensityMultiplier.value;
envLightData.rangeCompressionFactorCompensation = Mathf.Max(probe.rangeCompressionFactor, 1e-6f);
envLightData.influenceExtents = influence.extents;
switch (influence.envShape)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,10 @@ void LightLoop( float3 V, PositionInputs posInput, PreLightData preLightData, BS

ApplyDebugToLighting(context, builtinData, aggregateLighting);

// Note: We can't apply the IndirectDiffuseMultiplier here as with GBuffer, Emissive is part of the bakeDiffuseLighting.
// so IndirectDiffuseMultiplier is apply in PostInitBuiltinData or related location (like for probe volume)
aggregateLighting.indirect.specularReflected *= GetIndirectSpecularMultiplier(builtinData.renderingLayers);

// Also Apply indiret diffuse (GI)
// PostEvaluateBSDF will perform any operation wanted by the material and sum everything into diffuseLighting and specularLighting
PostEvaluateBSDF( context, V, posInput, preLightData, bsdfData, builtinData, aggregateLighting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ struct ShaderVariablesScreenSpaceLighting
// Ambient occlusion
public Vector4 _AmbientOcclusionParam; // xyz occlusion color, w directLightStrenght

public Vector4 _IndirectLightingMultiplier; // .x indirect diffuse multiplier (use with indirect lighting volume controler)
public float _IndirectDiffuseLightingMultiplier;
public uint _IndirectDiffuseLightingLayers;
public float _ReflectionLightingMultiplier;
public uint _ReflectionLightingLayers;

// Screen space refraction
public float _SSRefractionInvScreenWeightDistance; // Distance for screen space smoothstep with fallback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
float4 _DepthPyramidScale;
float4 _CameraMotionVectorsScale;
float4 _AmbientOcclusionParam;
float4 _IndirectLightingMultiplier;
float _IndirectDiffuseLightingMultiplier;
uint _IndirectDiffuseLightingLayers;
float _ReflectionLightingMultiplier;
uint _ReflectionLightingLayers;
float _SSRefractionInvScreenWeightDistance;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ void PostInitBuiltinData( float3 V, PositionInputs posInput, SurfaceData surfa
{
// Apply control from the indirect lighting volume settings - This is apply here so we don't affect emissive
// color in case of lit deferred for example and avoid material to have to deal with it
builtinData.bakeDiffuseLighting *= _IndirectLightingMultiplier.x;
builtinData.backBakeDiffuseLighting *= _IndirectLightingMultiplier.x;
float multiplier = GetIndirectDiffuseMultiplier(builtinData.renderingLayers);
builtinData.bakeDiffuseLighting *= multiplier;
builtinData.backBakeDiffuseLighting *= multiplier;

#ifdef MODIFY_BAKED_DIFFUSE_LIGHTING

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,11 @@ void PushGlobalParams(HDCamera hdCamera, CommandBuffer cmd)
// Set up UnityPerView CBuffer.
hdCamera.SetupGlobalParams(cmd, m_FrameCount);

cmd.SetGlobalVector(HDShaderIDs._IndirectLightingMultiplier, new Vector4(hdCamera.volumeStack.GetComponent<IndirectLightingController>().indirectDiffuseIntensity.value, 0, 0, 0));
IndirectLightingController indirectLightingController = hdCamera.volumeStack.GetComponent<IndirectLightingController>();
cmd.SetGlobalFloat(HDShaderIDs._IndirectDiffuseLightingMultiplier, indirectLightingController.indirectDiffuseLightingMultiplier.value);
cmd.SetGlobalInt(HDShaderIDs._IndirectDiffuseLightingLayers, hdCamera.frameSettings.IsEnabled(FrameSettingsField.LightLayers) ? (int)indirectLightingController.GetIndirectDiffuseLightingLayers() : -1);
cmd.SetGlobalFloat(HDShaderIDs._ReflectionLightingMultiplier, indirectLightingController.reflectionLightingMultiplier.value);
cmd.SetGlobalInt(HDShaderIDs._ReflectionLightingLayers, hdCamera.frameSettings.IsEnabled(FrameSettingsField.LightLayers) ? (int)indirectLightingController.GetReflectionLightingLayers() : -1);

// It will be overridden for transparent pass.
cmd.SetGlobalInt(HDShaderIDs._ColorMaskTransparentVel, (int)UnityEngine.Rendering.ColorWriteMask.All);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ static class HDShaderIDs
public static readonly int _NumTileClusteredX = Shader.PropertyToID("_NumTileClusteredX");
public static readonly int _NumTileClusteredY = Shader.PropertyToID("_NumTileClusteredY");

public static readonly int _IndirectLightingMultiplier = Shader.PropertyToID("_IndirectLightingMultiplier");
public static readonly int _IndirectDiffuseLightingMultiplier = Shader.PropertyToID("_IndirectDiffuseLightingMultiplier");
public static readonly int _IndirectDiffuseLightingLayers = Shader.PropertyToID("_IndirectDiffuseLightingLayers");
public static readonly int _ReflectionLightingMultiplier = Shader.PropertyToID("_ReflectionLightingMultiplier");
public static readonly int _ReflectionLightingLayers = Shader.PropertyToID("_ReflectionLightingLayers");

public static readonly int g_isLogBaseBufferEnabled = Shader.PropertyToID("g_isLogBaseBufferEnabled");
public static readonly int g_vLayeredOffsetsBuffer = Shader.PropertyToID("g_vLayeredOffsetsBuffer");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ void RenderIndirectDiffuse(HDCamera hdCamera, CommandBuffer cmd, ScriptableRende
// Bind the output texture
cmd.SetComputeTextureParam(indirectDiffuseCS, indirectDiffuseKernel, HDShaderIDs._GBufferTexture[0], m_GbufferManager.GetBuffer(0));
cmd.SetComputeTextureParam(indirectDiffuseCS, indirectDiffuseKernel, HDShaderIDs._GBufferTexture[3], m_GbufferManager.GetBuffer(3));
cmd.SetComputeVectorParam(indirectDiffuseCS, HDShaderIDs._IndirectLightingMultiplier, new Vector4(hdCamera.volumeStack.GetComponent<IndirectLightingController>().indirectDiffuseIntensity.value, 0, 0, 0));

IndirectLightingController indirectLightingController = hdCamera.volumeStack.GetComponent<IndirectLightingController>();
cmd.SetComputeFloatParam(indirectDiffuseCS, HDShaderIDs._IndirectDiffuseLightingMultiplier, indirectLightingController.indirectDiffuseLightingMultiplier.value);
cmd.SetComputeIntParam(indirectDiffuseCS, HDShaderIDs._IndirectDiffuseLightingLayers, hdCamera.frameSettings.IsEnabled(FrameSettingsField.LightLayers) ? (int)indirectLightingController.GetIndirectDiffuseLightingLayers() : -1);
cmd.SetComputeFloatParam(indirectDiffuseCS, HDShaderIDs._ReflectionLightingMultiplier, indirectLightingController.reflectionLightingMultiplier.value);
cmd.SetComputeIntParam(indirectDiffuseCS, HDShaderIDs._ReflectionLightingLayers, hdCamera.frameSettings.IsEnabled(FrameSettingsField.LightLayers) ? (int)indirectLightingController.GetReflectionLightingLayers() : -1);

// Evaluate the dispatch parameters
int areaTileSize = 8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ void IndirectDiffuseAccumulation(uint3 dispatchThreadId : SV_DispatchThreadID, u
uint2 currentPixelCoordinate = groupId * RAYTRACING_INDIRECT_DIFFUSE_TILE_SIZE + groupThreadId;

// Add the indirect diffuse to the buffer (while pre-multiplying by the base color)
_GBufferTexture3[COORD_TEXTURE2D_X(currentPixelCoordinate)] += LOAD_TEXTURE2D_X(_IndirectDiffuseTexture, currentPixelCoordinate) * LOAD_TEXTURE2D_X(_GBufferTexture0, currentPixelCoordinate) * _IndirectLightingMultiplier.x;
float indirectDiffuseMultiplier = GetIndirectDiffuseMultiplier(0xFF); // We don't have renderinglayer here
_GBufferTexture3[COORD_TEXTURE2D_X(currentPixelCoordinate)] += LOAD_TEXTURE2D_X(_IndirectDiffuseTexture, currentPixelCoordinate) * LOAD_TEXTURE2D_X(_GBufferTexture0, currentPixelCoordinate) * indirectDiffuseMultiplier;
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,17 @@ float GetInversePreviousExposureMultiplier()
return rcp(exposure + (exposure == 0.0)); // zero-div guard
}

// Helper function for indirect control volume
float GetIndirectDiffuseMultiplier(uint renderingLayers)
{
return (_IndirectDiffuseLightingLayers & renderingLayers) ? _IndirectDiffuseLightingMultiplier : 1.0f;
}

float GetIndirectSpecularMultiplier(uint renderingLayers)
{
return (_ReflectionLightingLayers & renderingLayers) ? _ReflectionLightingMultiplier : 1.0f;
}

// Functions to clamp UVs to use when RTHandle system is used.

float2 ClampAndScaleUV(float2 UV, float2 texelSize, float numberOfTexels)
Expand Down