浏览代码

Merge pull request #1790 from Unity-Technologies/IndirectLightingControlVolume

Indirect lighting control volume
/main
GitHub 6 年前
当前提交
0adc31b5
共有 10 个文件被更改,包括 81 次插入5 次删除
  1. 1
      com.unity.render-pipelines.high-definition/CHANGELOG.md
  2. 6
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs
  3. 3
      com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ShaderVariablesScreenSpaceLighting.hlsl
  4. 4
      com.unity.render-pipelines.high-definition/HDRP/Material/MaterialUtilities.hlsl
  5. 8
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs
  6. 2
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDStringConstants.cs
  7. 29
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/IndirectLightingControllerEditor.cs
  8. 11
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/IndirectLightingControllerEditor.cs.meta
  9. 11
      com.unity.render-pipelines.high-definition/HDRP/Lighting/IndirectLightingController.cs
  10. 11
      com.unity.render-pipelines.high-definition/HDRP/Lighting/IndirectLightingController.cs.meta

1
com.unity.render-pipelines.high-definition/CHANGELOG.md


- Added an option to disable light by type in the debug menu
- Added gradient sky
- Split EmissiveColor and bakeDiffuseLighting in forward avoiding the emissiveColor to be affect by SSAO
- Added a volume to control indirect light intensity
- Added EV 100 intensity unit for area lights
### Fixed

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


ContactShadows m_ContactShadows = null;
bool m_EnableContactShadow = false;
IndirectLightingController m_indirectLightingController = null;
// Following is an array of material of size eight for all combination of keyword: OUTPUT_SPLIT_LIGHTING - LIGHTLOOP_TILE_PASS - SHADOWS_SHADOWMASK - USE_FPTL_LIGHTLIST/USE_CLUSTERED_LIGHTLIST - DEBUG_DISPLAY
Material[] m_deferredLightingMaterial;

m_ContactShadows = VolumeManager.instance.stack.GetComponent<ContactShadows>();
m_EnableContactShadow = m_FrameSettings.enableContactShadows && m_ContactShadows.enable && m_ContactShadows.length > 0;
m_indirectLightingController = VolumeManager.instance.stack.GetComponent<IndirectLightingController>();
// Cluster
{

// Build light data
var envLightData = new EnvLightData();
envLightData.multiplier = probe.multiplier;
envLightData.multiplier = probe.multiplier * m_indirectLightingController.indirectSpecularIntensity;
envLightData.influenceExtents = probe.influenceExtents;
envLightData.blendNormalDistancePositive = probe.blendNormalDistancePositive;
envLightData.blendNormalDistanceNegative = probe.blendNormalDistanceNegative;

3
com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ShaderVariablesScreenSpaceLighting.hlsl


// Ambiant occlusion
float4 _AmbientOcclusionParam; // xyz occlusion color, w directLightStrenght
float4 _IndirectLightingMultiplier; // .x indirect diffuse multiplier (use with indirect lighting volume controler)
#else
// Rough refraction texture
// Color pyramid (width, height, lodcount, Unused)

4
com.unity.render-pipelines.high-definition/HDRP/Material/MaterialUtilities.hlsl


else
#endif
{
// 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;
#ifdef MODIFY_BAKED_DIFFUSE_LIGHTING
ModifyBakedDiffuseLighting(V, posInput, surfaceData, builtinData);
#endif

8
com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs


hdCamera.SetupGlobalStereoParams(cmd);
cmd.SetGlobalInt(HDShaderIDs._SSReflectionEnabled, hdCamera.frameSettings.enableSSR ? 1 : 0);
cmd.SetGlobalVector(HDShaderIDs._IndirectLightingMultiplier, new Vector4(VolumeManager.instance.stack.GetComponent<IndirectLightingController>().indirectDiffuseIntensity, 0, 0 , 0));
PushGlobalRTHandle(
cmd,

using (new ProfilingSample(cmd, "HDRenderPipeline::Render", CustomSamplerId.HDRenderPipelineRender.GetSampler()))
{
// Do anything we need to do upon a new frame.
m_LightLoop.NewFrame(currentFrameSettings);
// If we render a reflection view or a preview we should not display any debug information
// This need to be call before ApplyDebugDisplaySettings()
if (camera.cameraType == CameraType.Reflection || camera.cameraType == CameraType.Preview)

{
VolumeManager.instance.Update(hdCamera.volumeAnchor, hdCamera.volumeLayerMask);
}
// Do anything we need to do upon a new frame.
// The NewFrame must be after the VolumeManager update and before Resize because it uses properties set in NewFrame
m_LightLoop.NewFrame(currentFrameSettings);
Resize(hdCamera);

2
com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDStringConstants.cs


public static readonly int _NumTileFtplY = Shader.PropertyToID("_NumTileFtplY");
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 g_isLogBaseBufferEnabled = Shader.PropertyToID("g_isLogBaseBufferEnabled");
public static readonly int g_vLayeredOffsetsBuffer = Shader.PropertyToID("g_vLayeredOffsetsBuffer");

29
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/IndirectLightingControllerEditor.cs


using System.Collections;
using UnityEngine;
using UnityEditor;
using UnityEditor.Experimental.Rendering;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
[CanEditMultipleObjects]
[VolumeComponentEditor(typeof(IndirectLightingController))]
public class IndirectLightingControllerEditor : VolumeComponentEditor
{
SerializedDataParameter m_IndirectDiffuseIntensity;
SerializedDataParameter m_IndirectSpecularIntensity;
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));
}
public override void OnInspectorGUI()
{
PropertyField(m_IndirectDiffuseIntensity, CoreEditorUtils.GetContent("Indirect Diffuse Intensity|Multiplier for the baked diffuse lighting."));
PropertyField(m_IndirectSpecularIntensity, CoreEditorUtils.GetContent("Indirect Specular Intensity|Multiplier for the reflected specular light."));
}
}
}

11
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/IndirectLightingControllerEditor.cs.meta


fileFormatVersion: 2
guid: 8f4eec32d24065f4db3249afcf3153cb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.render-pipelines.high-definition/HDRP/Lighting/IndirectLightingController.cs


using System;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
[Serializable]
public class IndirectLightingController : VolumeComponent
{
public MinFloatParameter indirectSpecularIntensity = new MinFloatParameter(1.0f, 0.0f);
public MinFloatParameter indirectDiffuseIntensity = new MinFloatParameter(1.0f, 0.0f);
}
}

11
com.unity.render-pipelines.high-definition/HDRP/Lighting/IndirectLightingController.cs.meta


fileFormatVersion: 2
guid: f034cba68ab55e046ae1445a42f18c0e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存