浏览代码

Add support for LightLayers on reflection probe

/main
sebastienlagarde 6 年前
当前提交
f0c92016
共有 11 个文件被更改,包括 30 次插入10 次删除
  1. 2
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.ContextualMenu.cs.meta
  2. 2
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Drawers.cs
  3. 2
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Skin.cs
  4. 4
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedHDProbe.cs
  5. 6
      com.unity.render-pipelines.high-definition/HDRP/HDRenderPipelineAsset.asset
  6. 1
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightDefinition.cs
  7. 1
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightDefinition.cs.hlsl
  8. 1
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs
  9. 7
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.hlsl
  10. 9
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs
  11. 5
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ProbeWrapper.cs

2
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.ContextualMenu.cs.meta


fileFormatVersion: 2
guid: 3f4d3bee74f54434ca6db826ccc28f6f
guid: f9ddf94c77394c14986865eb30c51d79
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Drawers.cs


protected static void Drawer_SectionCustomSettings(HDProbeUI s, SerializedHDProbe d, Editor o)
{
EditorGUILayout.PropertyField(d.lightLayer, lightLayerContent);
EditorGUILayout.PropertyField(d.lightLayers, lightLayersContent);
EditorGUILayout.PropertyField(d.weight, weightContent);

2
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Skin.cs


static readonly GUIContent weightContent = CoreEditorUtils.GetContent("Weight|Blend weight applied on this reflection probe. This can be used for fading in or out a reflection probe.");
static readonly GUIContent multiplierContent = CoreEditorUtils.GetContent("Intensity Multiplier|Allows you to boost or dimmer the reflected cubemap. Values above 1 will make reflections brighter and values under 1 will make reflections darker. Using values different than 1 is not physically correct.");
static readonly GUIContent lightLayerContent = CoreEditorUtils.GetContent("Light Layer|Specifies the current light layers that the light affect. Corresponding renderer with the same flags will be lit by this light.");
static readonly GUIContent lightLayersContent = CoreEditorUtils.GetContent("Light Layers|Specifies the current light layers that the light affect. Corresponding renderer with the same flags will be lit by this light.");
static readonly GUIContent textureSizeContent = CoreEditorUtils.GetContent("Probe Texture Size (Set By HDRP)");
static readonly GUIContent compressionTextureContent = CoreEditorUtils.GetContent("Probe Compression (Set By HDRP)");

4
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedHDProbe.cs


internal SerializedFrameSettings frameSettings;
internal SerializedProperty lightLayer;
internal SerializedProperty lightLayers;
internal SerializedProperty weight;
internal SerializedProperty multiplier;

frameSettings = new SerializedFrameSettings(serializedObject.Find((HDProbe p) => p.frameSettings));
lightLayer = serializedObject.Find((HDProbe p) => p.lightLayer);
lightLayers = serializedObject.Find((HDProbe p) => p.lightLayers);
weight = serializedObject.Find((HDProbe p) => p.weight);
multiplier = serializedObject.Find((HDProbe p) => p.multiplier);

6
com.unity.render-pipelines.high-definition/HDRP/HDRenderPipelineAsset.asset


MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0

increaseSssSampleCount: 0
supportVolumetrics: 1
increaseResolutionOfVolumetrics: 0
supportLightLayers: 0
supportLightLayers: 1
supportOnlyForward: 0
supportDecals: 1
supportMSAA: 0

shadowInitParams:
shadowAtlasWidth: 4096
shadowAtlasHeight: 4096
shadowMap16Bit: 0
maxPointLightShadows: 6
maxSpotLightShadows: 12
maxDirectionalLightShadows: 1

1
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightDefinition.cs


public struct EnvLightData
{
// Packing order depends on chronological access to avoid cache misses
public uint lightLayers;
// Proxy properties
public Vector3 capturePositionRWS;

1
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightDefinition.cs.hlsl


// PackingRules = Exact
struct EnvLightData
{
uint lightLayers;
float3 capturePositionRWS;
int influenceShapeType;
float3 proxyExtents;

1
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs


// Build light data
var envLightData = new EnvLightData();
envLightData.lightLayers = probe.GetLightLayers();
envLightData.influenceShapeType = probe.influenceShapeType;
envLightData.weight = probe.weight;
envLightData.multiplier = probe.multiplier * m_indirectLightingController.indirectSpecularIntensity;

7
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.hlsl


// Define macro for a better understanding of the loop
#define EVALUATE_BSDF_ENV(envLightData, TYPE, type) \
IndirectLighting lighting = EvaluateBSDF_Env(context, V, posInput, preLightData, envLightData, bsdfData, envLightData.influenceShapeType, MERGE_NAME(GPUIMAGEBASEDLIGHTINGTYPE_, TYPE), MERGE_NAME(type, HierarchyWeight)); \
AccumulateIndirectLighting(lighting, aggregateLighting);
if (IsMatchingLightLayer(envLightData.lightLayers, builtinData.renderingLayers)) \
{ \
IndirectLighting lighting = EvaluateBSDF_Env(context, V, posInput, preLightData, envLightData, bsdfData, envLightData.influenceShapeType, MERGE_NAME(GPUIMAGEBASEDLIGHTINGTYPE_, TYPE), MERGE_NAME(type, HierarchyWeight)); \
AccumulateIndirectLighting(lighting, aggregateLighting); \
}
// First loop iteration
if (featureFlags & (LIGHTFEATUREFLAGS_ENV | LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_SSREFRACTION | LIGHTFEATUREFLAGS_SSREFLECTION))

9
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs


RenderTexture m_RealtimeTexture = null;
/// <summary>Light layer to use by this probe.</summary>
public LightLayerEnum lightLayer = LightLayerEnum.LightLayerDefault;
public LightLayerEnum lightLayers = LightLayerEnum.LightLayerDefault;
// This function return a mask of light layers as uint and handle the case of Everything as being 0xFF and not -1
public uint GetLightLayers()
{
int value = (int)(lightLayers);
return value < 0 ? (uint)LightLayerEnum.Everything : (uint)value;
}
/// <summary>ProxyVolume currently used by this probe.</summary>
public ReflectionProxyVolumeComponent proxyVolume { get { return m_ProxyVolume; } }

5
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ProbeWrapper.cs


public abstract Matrix4x4 proxyToWorld { get; }
public abstract Vector3 proxyExtents { get; }
public abstract bool infiniteProjection { get; }
public abstract uint GetLightLayers();
}
class VisibleReflectionProbeWrapper : ProbeWrapper

: influenceToWorld;
}
}
public override uint GetLightLayers() { return additional.GetLightLayers(); }
}
class PlanarReflectionProbeWrapper : ProbeWrapper

public override ReflectionProbeMode mode { get { return planarReflectionProbe.mode; } }
public override Matrix4x4 proxyToWorld { get { return planarReflectionProbe.proxyToWorld; } }
public override uint GetLightLayers() { return planarReflectionProbe.GetLightLayers(); }
}
}
正在加载...
取消
保存