浏览代码

Merge branch 'HDRP/staging' into HDRP/refactor-reflectionProbe/clean-proxy-volume

/main
sebastienlagarde 7 年前
当前提交
10164527
共有 47 个文件被更改,包括 1685 次插入67 次删除
  1. 4
      .gitmodules
  2. 1
      TestProjects/HDRP_Tests/Packages/manifest.json
  3. 1
      TestProjects/LWGraphicsTest/Packages/manifest.json
  4. 2
      TestProjects/PostProcessing/Packages/manifest.json
  5. 1
      TestProjects/ShaderGraph/Packages/manifest.json
  6. 6
      build.py
  7. 16
      com.unity.render-pipelines.core/CoreRP/Textures/TextureCache.cs
  8. 3
      com.unity.render-pipelines.high-definition/CHANGELOG.md
  9. 11
      com.unity.render-pipelines.high-definition/HDRP/Debug/DebugDisplay.cs
  10. 5
      com.unity.render-pipelines.high-definition/HDRP/Debug/LightingDebug.cs
  11. 4
      com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/HDAssetFactory.cs
  12. 81
      com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/HDRISky/HDRISkyEditor.cs
  13. 10
      com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/SkySettingsEditor.cs
  14. 10
      com.unity.render-pipelines.high-definition/HDRP/HDRenderPipelineAsset.asset
  15. 13
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightDefinition.cs
  16. 49
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs
  17. 2
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs
  18. 4
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ProbeWrapper.cs
  19. 2
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs
  20. 1
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDStringConstants.cs
  21. 2
      com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/HDRenderPipelineResources.asset
  22. 2
      com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/RenderPipelineResources.cs
  23. 2
      com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/HDRISky.shader
  24. 21
      com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/HDRISkyRenderer.cs
  25. 2
      com.unity.render-pipelines.high-definition/HDRP/Sky/SkyRenderingContext.cs
  26. 31
      com.unity.render-pipelines.high-definition/HDRP/Sky/SkySettings.cs
  27. 3
      com.unity.render-pipelines.high-definition/HDRP/Sky/VisualEnvironment.cs
  28. 2
      com.unity.render-pipelines.high-definition/package.json
  29. 2
      com.unity.render-pipelines.lightweight/package.json
  30. 2
      com.unity.testframework.graphics/package.json
  31. 8
      com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/GradientSky.meta
  32. 1001
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs.orig
  33. 75
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs.orig
  34. 8
      com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky.meta
  35. 88
      com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/IntegrateHDRISky.shader
  36. 9
      com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/IntegrateHDRISky.shader.meta
  37. 42
      com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/GradientSky/GradientSkyEditor.cs
  38. 11
      com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/GradientSky/GradientSkyEditor.cs.meta
  39. 32
      com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.cs
  40. 11
      com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.cs.meta
  41. 9
      com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.shader.meta
  42. 63
      com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSkyRenderer.cs
  43. 11
      com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSkyRenderer.cs.meta
  44. 81
      com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.shader
  45. 8
      com.unity.render-pipelines.high-definition/HDRP/Sky/AtmosphericScattering.meta

4
.gitmodules


[submodule "com.unity.postprocessing"]
path = com.unity.postprocessing
url = https://github.com/Unity-Technologies/PostProcessing.git
branch = v2

1
TestProjects/HDRP_Tests/Packages/manifest.json


{
"dependencies": {
"com.unity.postprocessing": "file:../../../com.unity.postprocessing",
"com.unity.render-pipelines.core": "file:../../../com.unity.render-pipelines.core",
"com.unity.render-pipelines.high-definition": "file:../../../com.unity.render-pipelines.high-definition",
"com.unity.shadergraph": "file:../../../com.unity.shadergraph",

1
TestProjects/LWGraphicsTest/Packages/manifest.json


{
"dependencies": {
"com.unity.postprocessing": "file:../../../com.unity.postprocessing",
"com.unity.render-pipelines.core": "file:../../../com.unity.render-pipelines.core",
"com.unity.render-pipelines.lightweight": "file:../../../com.unity.render-pipelines.lightweight",
"com.unity.shadergraph": "file:../../../com.unity.shadergraph",

2
TestProjects/PostProcessing/Packages/manifest.json


{
"dependencies": {
"com.unity.postprocessing": "file:../../../com.unity.postprocessing",
"com.unity.postprocessing": "2.0.9-preview",
"com.unity.testframework.graphics": "file:../../../com.unity.testframework.graphics",
"com.unity.textmeshpro": "1.2.4"
},

1
TestProjects/ShaderGraph/Packages/manifest.json


{
"dependencies": {
"com.unity.postprocessing": "file:../../../com.unity.postprocessing",
"com.unity.render-pipelines.core": "file:../../../com.unity.render-pipelines.core",
"com.unity.render-pipelines.high-definition": "file:../../../com.unity.render-pipelines.high-definition",
"com.unity.render-pipelines.lightweight": "file:../../../com.unity.render-pipelines.lightweight",

6
build.py


("com.unity.render-pipelines.lightweight", os.path.join("com.unity.render-pipelines.lightweight")),
("com.unity.render-pipelines.high-definition", os.path.join("com.unity.render-pipelines.high-definition")),
("com.unity.shadergraph", os.path.join("com.unity.shadergraph")),
("com.unity.postprocessing", os.path.join("com.unity.postprocessing")),
("com.unity.testframework.graphics", os.path.join("com.unity.testframework.graphics")),
("com.unity.testframework.graphics", os.path.join("com.unity.testframework.graphics"))
]
def test_packages_list():

"com.unity.render-pipelines.high-definition",
"com.unity.shadergraph",
"com.unity.postprocessing"
"com.unity.shadergraph"
]
if __name__ == "__main__":

16
com.unity.render-pipelines.core/CoreRP/Textures/TextureCache.cs


{
}
bool TextureHasMipmaps(Texture texture)
{
var crt = texture as CustomRenderTexture;
if (texture is Texture2D)
return ((Texture2D)texture).mipmapCount > 1;
else if (crt is CustomRenderTexture)
return ((CustomRenderTexture)texture).useMipMap;
return false;
}
public override void TransferToSlice(CommandBuffer cmd, int sliceIndex, Texture texture)
{
var mismatch = (m_Cache.width != texture.width) || (m_Cache.height != texture.height);

}
else
{
cmd.CopyTexture(texture, 0, m_Cache, sliceIndex);
if (TextureHasMipmaps(texture))
cmd.CopyTexture(texture, 0, m_Cache, sliceIndex);
else
Debug.LogWarning("The texture '" + texture + "' should have mipmaps to be handeled by the cookie texture array");
}
}

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


- Added LightLayers support (Base on mask from renderers name RenderingLayers and mask from light name LightLayers - if they match, the light apply) - cost an extra GBuffer in deferred (more bandwidth)
- When LightLayers is enabled, the AmbientOclusion is store in the GBuffer in deferred path allowing to avoid double occlusion with SSAO. In forward the double occlusion is now always avoided.
- Added the possibility to add an override transform on the camera for volume interpolation
- Added desired lux intensity and auto multiplier for HDRI sky
- Added an option to disable light by type in the debug menu
- Added gradient sky
### Fixed
- Fixed an issue with PreIntegratedFGD texture being sometimes destroyed and not regenerated causing rendering to break

11
com.unity.render-pipelines.high-definition/HDRP/Debug/DebugDisplay.cs


{
var list = new List<DebugUI.Widget>();
list.Add(new DebugUI.Foldout
{
displayName = "Show Light By Type",
children = {
new DebugUI.BoolField { displayName = "Show Directional Lights", getter = () => lightingDebugSettings.showDirectionalLight, setter = value => lightingDebugSettings.showDirectionalLight = value },
new DebugUI.BoolField { displayName = "Show Punctual Lights", getter = () => lightingDebugSettings.showPunctualLight, setter = value => lightingDebugSettings.showPunctualLight = value },
new DebugUI.BoolField { displayName = "Show Area Lights", getter = () => lightingDebugSettings.showAreaLight, setter = value => lightingDebugSettings.showAreaLight = value },
new DebugUI.BoolField { displayName = "Show Reflection Probe", getter = () => lightingDebugSettings.showReflectionProbe, setter = value => lightingDebugSettings.showReflectionProbe = value },
}
});
list.Add(new DebugUI.EnumField
{
displayName = "Shadow Debug Mode",

5
com.unity.render-pipelines.high-definition/HDRP/Debug/LightingDebug.cs


public float debugExposure = 0.0f;
public bool showPunctualLight = true;
public bool showDirectionalLight = true;
public bool showAreaLight = true;
public bool showReflectionProbe = true;
public LightLoop.TileClusterDebug tileClusterDebug = LightLoop.TileClusterDebug.None;
public LightLoop.TileClusterCategoryDebug tileClusterDebugByCategory = LightLoop.TileClusterCategoryDebug.Punctual;
}

4
com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/HDAssetFactory.cs


newAsset.buildProbabilityTables = Load<ComputeShader>(HDRenderPipelinePath + "Material/GGXConvolution/BuildProbabilityTables.compute");
newAsset.computeGgxIblSampleData = Load<ComputeShader>(HDRenderPipelinePath + "Material/GGXConvolution/ComputeGgxIblSampleData.compute");
newAsset.GGXConvolve = Load<Shader>(HDRenderPipelinePath + "Material/GGXConvolution/GGXConvolve.shader");
newAsset.opaqueAtmosphericScattering = Load<Shader>(HDRenderPipelinePath + "Sky/OpaqueAtmosphericScattering.shader");
newAsset.opaqueAtmosphericScattering = Load<Shader>(HDRenderPipelinePath + "Lighting/AtmosphericScattering/OpaqueAtmosphericScattering.shader");
newAsset.integrateHdriSky = Load<Shader>(HDRenderPipelinePath + "Sky/HDRISky/IntegrateHDRISky.shader");
newAsset.gradientSky = Load<Shader>(HDRenderPipelinePath + "Sky/GradientSky/GradientSky.shader");
// Skybox/Cubemap is a builtin shader, must use Sahder.Find to access it. It is fine because we are in the editor
newAsset.skyboxCubemap = Shader.Find("Skybox/Cubemap");

81
com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/HDRISky/HDRISkyEditor.cs


using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
namespace UnityEditor.Experimental.Rendering.HDPipeline

: SkySettingsEditor
{
SerializedDataParameter m_hdriSky;
SerializedDataParameter m_DesiredLuxValue;
SerializedDataParameter m_IntensityMode;
SerializedDataParameter m_UpperHemisphereLuxValue;
RTHandleSystem.RTHandle m_IntensityTexture;
Material m_IntegrateHDRISkyMaterial; // Compute the HDRI sky intensity in lux for the skybox
Texture2D readBackTexture;
public override void OnEnable()
{

var o = new PropertyFetcher<HDRISky>(serializedObject);
m_hdriSky = Unpack(o.Find(x => x.hdriSky));
m_DesiredLuxValue = Unpack(o.Find(x => x.desiredLuxValue));
m_IntensityMode = Unpack(o.Find(x => x.skyIntensityMode));
m_UpperHemisphereLuxValue = Unpack(o.Find(x => x.upperHemisphereLuxValue));
m_IntensityTexture = RTHandles.Alloc(1, 1, colorFormat: RenderTextureFormat.ARGBFloat, sRGB: false);
var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;
m_IntegrateHDRISkyMaterial = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.integrateHdriSky);
readBackTexture = new Texture2D(1, 1, TextureFormat.RGBAFloat, false, false);
}
public override void OnDisable()
{
if (m_IntensityTexture != null)
RTHandles.Release(m_IntensityTexture);
readBackTexture = null;
}
// Compute the lux value in the upper hemisphere of the HDRI skybox
public void GetUpperHemisphereLuxValue()
{
Cubemap hdri = m_hdriSky.value.objectReferenceValue as Cubemap;
if (hdri == null)
return;
m_IntegrateHDRISkyMaterial.SetTexture(HDShaderIDs._Cubemap, hdri);
Graphics.Blit(Texture2D.whiteTexture, m_IntensityTexture.rt, m_IntegrateHDRISkyMaterial);
// Copy the rendertexture containing the lux value inside a Texture2D
RenderTexture.active = m_IntensityTexture.rt;
readBackTexture.ReadPixels(new Rect(0.0f, 0.0f, 1, 1), 0, 0);
RenderTexture.active = null;
// And then the value inside this texture
Color hdriIntensity = readBackTexture.GetPixel(0, 0);
m_UpperHemisphereLuxValue.value.floatValue = hdriIntensity.r;
PropertyField(m_hdriSky);
EditorGUI.BeginChangeCheck();
{
PropertyField(m_hdriSky);
EditorGUILayout.Space();
PropertyField(m_IntensityMode);
}
if (EditorGUI.EndChangeCheck())
{
GetUpperHemisphereLuxValue();
}
EditorGUILayout.Space();
if (m_IntensityMode.value.enumValueIndex == (int)SkyIntensityMode.Lux)
{
EditorGUI.indentLevel++;
PropertyField(m_DesiredLuxValue);
// Hide exposure and multiplier
m_CommonUIElementsMask &= ~(uint)(SkySettingsUIElement.Exposure | SkySettingsUIElement.Multiplier);
m_CommonUIElementsMask |= (uint)SkySettingsUIElement.IndentExposureAndMultiplier;
// Show the multiplier as read-only
EditorGUI.BeginDisabledGroup(true);
PropertyField(m_UpperHemisphereLuxValue);
EditorGUI.EndDisabledGroup();
EditorGUI.indentLevel--;
}
else
{
m_CommonUIElementsMask |= (uint)(SkySettingsUIElement.Exposure | SkySettingsUIElement.Multiplier);
}
base.CommonSkySettingsGUI();
}
}

10
com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/SkySettingsEditor.cs


Multiplier = 1 << 1,
Rotation = 1 << 2,
UpdateMode = 1 << 3,
IncludeSunInBaking = 1 << 4
IncludeSunInBaking = 1 << 4,
IndentExposureAndMultiplier = 1 << 5,
}
SerializedDataParameter m_SkyExposure;

protected void CommonSkySettingsGUI()
{
if ((m_CommonUIElementsMask & (uint)SkySettingsUIElement.IndentExposureAndMultiplier) != 0)
EditorGUI.indentLevel++;
if ((m_CommonUIElementsMask & (uint)SkySettingsUIElement.IndentExposureAndMultiplier) != 0)
EditorGUI.indentLevel--;
if ((m_CommonUIElementsMask & (uint)SkySettingsUIElement.Rotation) != 0)
PropertyField(m_SkyRotation);

PropertyField(m_IncludeSunInBaking);
}
}
}
}

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


m_FrameSettings:
enableShadow: 1
enableContactShadows: 1
enableShadowMask: 1
enableSSR: 1
enableSSAO: 1
enableSubsurfaceScattering: 1

enableLightLayers: 1
diffuseGlobalDimmer: 1
specularGlobalDimmer: 1
enableForwardRenderingOnly: 0

enableOpaqueObjects: 1
enableTransparentObjects: 1
enableMSAA: 0
enableShadowMask: 1
lightLoopSettings:
enableTileAndCluster: 1
enableComputeLightEvaluation: 1

supportSSR: 1
supportSSAO: 1
supportSubsurfaceScattering: 1
supportOnlyForward: 0
supportRuntimeDebugDisplay: 1
supportDitheringCrossFade: 1
supportLightLayers: 0
supportOnlyForward: 0
supportRuntimeDebugDisplay: 1
supportDitheringCrossFade: 1
lightLoopSettings:
cookieSize: 128
cookieTexArraySize: 16

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


// Disk,
};
public static class GPULightTypeExtension
{
public static bool IsAreaLight(this GPULightType lightType)
{
return lightType == GPULightType.Rectangle || lightType == GPULightType.Line;
}
public static bool IsSpot(this GPULightType lightType)
{
return lightType == GPULightType.Spot || lightType == GPULightType.ProjectorBox || lightType == GPULightType.ProjectorPyramid;
}
}
// This is use to distinguish between reflection and refraction probe in LightLoop
[GenerateHLSL]
public enum GPUImageBasedLightingType

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


namespace UnityEngine.Experimental.Rendering.HDPipeline
{
class ShadowSetup : IDisposable
{
// shadow related stuff

return true;
}
public bool GetDirectionalLightData(CommandBuffer cmd, ShadowSettings shadowSettings, GPULightType gpuLightType, VisibleLight light, HDAdditionalLightData additionalData, AdditionalShadowData additionalShadowData, int lightIndex)
public bool GetDirectionalLightData(CommandBuffer cmd, ShadowSettings shadowSettings, GPULightType gpuLightType, VisibleLight light, HDAdditionalLightData additionalData, AdditionalShadowData additionalShadowData, int lightIndex, DebugDisplaySettings debugDisplaySettings)
{
var directionalLightData = new DirectionalLightData();

return false;
// Discard light if disabled in debug display settings
if (!debugDisplaySettings.lightingDebugSettings.showDirectionalLight)
return false;
directionalLightData.lightLayers = additionalData.GetLightLayers();

public bool GetLightData(CommandBuffer cmd, ShadowSettings shadowSettings, Camera camera, GPULightType gpuLightType,
VisibleLight light, HDAdditionalLightData additionalLightData, AdditionalShadowData additionalshadowData,
int lightIndex, ref Vector3 lightDimensions)
int lightIndex, ref Vector3 lightDimensions, DebugDisplaySettings debugDisplaySettings)
{
var lightData = new LightData();

lightData.positionRWS = light.light.transform.position;
bool applyRangeAttenuation = additionalLightData.applyRangeAttenuation && (gpuLightType != GPULightType.ProjectorBox);
// Discard light if disabled in debug display settings
if (lightData.lightType.IsAreaLight())
{
if (!debugDisplaySettings.lightingDebugSettings.showAreaLight)
return false;
}
else
{
if (!debugDisplaySettings.lightingDebugSettings.showPunctualLight)
return false;
}
// In the shader we do range remapping: (x - start) / (end - start) = (dist^2 * rangeAttenuationScale + rangeAttenuationBias)
if (applyRangeAttenuation)

}
}
public bool GetEnvLightData(CommandBuffer cmd, Camera camera, ProbeWrapper probe)
public bool GetEnvLightData(CommandBuffer cmd, Camera camera, ProbeWrapper probe, DebugDisplaySettings debugDisplaySettings)
{
// For now we won't display real time probe when rendering one.
// TODO: We may want to display last frame result but in this case we need to be careful not to update the atlas before all realtime probes are rendered (for frame coherency).

// Discard probe if disabled in debug menu
if (!debugDisplaySettings.lightingDebugSettings.showReflectionProbe)
return false;
var capturePosition = Vector3.zero;
var influenceToWorld = probe.influenceToWorld;

// Return true if BakedShadowMask are enabled
public bool PrepareLightsForGPU(CommandBuffer cmd, HDCamera hdCamera, ShadowSettings shadowSettings, CullResults cullResults,
ReflectionProbeCullResults reflectionProbeCullResults, DensityVolumeList densityVolumes)
ReflectionProbeCullResults reflectionProbeCullResults, DensityVolumeList densityVolumes, DebugDisplaySettings debugDisplaySettings)
{
using (new ProfilingSample(cmd, "Prepare Lights For GPU"))
{

// Directional rendering side, it is separated as it is always visible so no volume to handle here
if (gpuLightType == GPULightType.Directional)
{
if (GetDirectionalLightData(cmd, shadowSettings, gpuLightType, light, additionalLightData, additionalShadowData, lightIndex))
if (GetDirectionalLightData(cmd, shadowSettings, gpuLightType, light, additionalLightData, additionalShadowData, lightIndex, debugDisplaySettings))
{
directionalLightcount++;

Vector3 lightDimensions = new Vector3(); // X = length or width, Y = height, Z = range (depth)
// Punctual, area, projector lights - the rendering side.
if (GetLightData(cmd, shadowSettings, camera, gpuLightType, light, additionalLightData, additionalShadowData, lightIndex, ref lightDimensions))
if (GetLightData(cmd, shadowSettings, camera, gpuLightType, light, additionalLightData, additionalShadowData, lightIndex, ref lightDimensions, debugDisplaySettings))
{
switch (lightCategory)
{

var probeWrapper = ProbeWrapper.Wrap(probe, planarProbe);
if (GetEnvLightData(cmd, camera, probeWrapper))
if (GetEnvLightData(cmd, camera, probeWrapper, debugDisplaySettings))
{
GetEnvLightVolumeDataAndBound(probeWrapper, lightVolumeType, worldToView);
if (stereoEnabled)

// These two buffers have been set in Rebuild()
s_ConvexBoundsBuffer.SetData(m_lightList.bounds);
s_LightVolumeDataBuffer.SetData(m_lightList.lightVolumes);
}
HDAdditionalReflectionData GetHDAdditionalReflectionData(VisibleReflectionProbe probe)
{
var add = probe.probe.GetComponent<HDAdditionalReflectionData>();
if (add == null)
{
add = HDUtils.s_DefaultHDAdditionalReflectionData;
Vector3 distance = Vector3.one * probe.blendDistance;
add.influenceVolume.boxBlendDistancePositive = distance;
add.influenceVolume.boxBlendDistanceNegative = distance;
add.influenceVolume.shape = InfluenceShape.Box;
}
return add;
}
HDAdditionalLightData GetHDAdditionalLightData(VisibleLight light)

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


set { m_RefreshMode = value; }
}
void Awake()
internal void Awake()
{
if (influenceVolume == null)
influenceVolume = new InfluenceVolume();

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


if (add == null)
{
add = HDUtils.s_DefaultHDAdditionalReflectionData;
if (add.influenceVolume == null)
{
add.Awake(); // We need to init the 'default' data if it isn't
}
Vector3 distance = Vector3.one * probe.blendDistance;
add.influenceVolume.boxBlendDistancePositive = distance;
add.influenceVolume.boxBlendDistanceNegative = distance;

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


bool enableBakeShadowMask;
using (new ProfilingSample(cmd, "TP_PrepareLightsForGPU", CustomSamplerId.TPPrepareLightsForGPU.GetSampler()))
{
enableBakeShadowMask = m_LightLoop.PrepareLightsForGPU(cmd, hdCamera, m_ShadowSettings, m_CullResults, m_ReflectionProbeCullResults, densityVolumes);
enableBakeShadowMask = m_LightLoop.PrepareLightsForGPU(cmd, hdCamera, m_ShadowSettings, m_CullResults, m_ReflectionProbeCullResults, densityVolumes, m_DebugDisplaySettings);
}
ConfigureForShadowMask(enableBakeShadowMask, cmd);
ConfigureForLightLayers(hdCamera.frameSettings.enableLightLayers, cmd);

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


public static readonly int _ThicknessRemap = Shader.PropertyToID("_ThicknessRemap");
public static readonly int _Cubemap = Shader.PropertyToID("_Cubemap");
public static readonly int _InvOmegaP = Shader.PropertyToID("_InvOmegaP");
public static readonly int _SkyParam = Shader.PropertyToID("_SkyParam");
public static readonly int _PixelCoordToViewDirWS = Shader.PropertyToID("_PixelCoordToViewDirWS");

2
com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/HDRenderPipelineResources.asset


GGXConvolve: {fileID: 4800000, guid: 123ed592ad5c2494b8aed301fd609e7b, type: 3}
opaqueAtmosphericScattering: {fileID: 4800000, guid: 32f724728cf19904291226f239ec16f0, type: 3}
hdriSky: {fileID: 4800000, guid: 9bd32a6ece529fd4f9408b8d7e00c10d, type: 3}
integrateHdriSky: {fileID: 4800000, guid: 48db2705cf2856d4e893eb30a6892d1b, type: 3}
gradientSky: {fileID: 4800000, guid: 2b5d4f1b26f03dc4a873b093e0c4adb1, type: 3}
preIntegratedFGD_GGXDisneyDiffuse: {fileID: 4800000, guid: 123f13d52852ef547b2962de4bd9eaad, type: 3}
preIntegratedFGD_CharlieClothLambert: {fileID: 4800000, guid: 3b3bf235775cf8b4baae7f3306787ab0, type: 3}
encodeBC6HCS: {fileID: 7200000, guid: aa922d239de60304f964e24488559eeb, type: 3}

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


public Shader GGXConvolve;
public Shader opaqueAtmosphericScattering;
public Shader hdriSky;
public Shader integrateHdriSky;
public Shader gradientSky;
// Material
public Shader preIntegratedFGD_GGXDisneyDiffuse;

2
com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/HDRISky.shader


}
Fallback Off
}
}

21
com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/HDRISkyRenderer.cs


HDUtils.SetRenderTarget(builtinParams.commandBuffer, builtinParams.hdCamera, builtinParams.colorBuffer, builtinParams.depthBuffer);
}
}
float luxMultiplier = m_HdriSkyParams.desiredLuxValue.value / m_HdriSkyParams.upperHemisphereLuxValue.value;
float multiplier = (m_HdriSkyParams.skyIntensityMode == SkyIntensityMode.Exposure) ? m_HdriSkyParams.multiplier.value : luxMultiplier;
float exposure = (m_HdriSkyParams.skyIntensityMode == SkyIntensityMode.Exposure) ? GetExposure(m_HdriSkyParams, builtinParams.debugSettings) : 0;
m_SkyHDRIMaterial.SetVector(HDShaderIDs._SkyParam, new Vector4(GetExposure(m_HdriSkyParams, builtinParams.debugSettings), m_HdriSkyParams.multiplier, -m_HdriSkyParams.rotation, 0.0f)); // -rotation to match Legacy...
m_SkyHDRIMaterial.SetVector(HDShaderIDs._SkyParam, new Vector4(exposure, multiplier, -m_HdriSkyParams.rotation, 0.0f)); // -rotation to match Legacy...
// This matrix needs to be updated at the draw call frequency.
m_PropertyBlock.SetMatrix(HDShaderIDs._PixelCoordToViewDirWS, builtinParams.pixelCoordToViewDirMatrix);
CoreUtils.DrawFullScreen(builtinParams.commandBuffer, m_SkyHDRIMaterial, m_PropertyBlock, renderForCubemap ? 0 : 1);
using (new ProfilingSample(builtinParams.commandBuffer, "Draw sky"))
{
// This matrix needs to be updated at the draw call frequency.
m_PropertyBlock.SetMatrix(HDShaderIDs._PixelCoordToViewDirWS, builtinParams.pixelCoordToViewDirMatrix);
CoreUtils.DrawFullScreen(builtinParams.commandBuffer, m_SkyHDRIMaterial, m_PropertyBlock, renderForCubemap ? 0 : 1);
}
}
public override bool IsValid()

}
}
}

2
com.unity.render-pipelines.high-definition/HDRP/Sky/SkyRenderingContext.cs


}
}
}
}
}

31
com.unity.render-pipelines.high-definition/HDRP/Sky/SkySettings.cs


: base(value, overrideState) {}
}
public enum SkyIntensityMode
{
Exposure,
Lux,
}
[System.Flags]
public enum SkySettingsPropertyFlags
{
ShowMultiplierAndEV = (1 << 0),
ShowRotation = (1 << 1),
ShowUpdateMode = (1 << 2),
}
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class SkyIntensityParameter : VolumeParameter<SkyIntensityMode>
{
public SkyIntensityParameter(SkyIntensityMode value, bool overrideState = false)
: base(value, overrideState) {}
}
[Tooltip("Sky intensity mode")]
public SkyIntensityParameter skyIntensityMode = new SkyIntensityParameter(SkyIntensityMode.Exposure);
[Tooltip("Auto multiplier from the HDRI sky")]
public MinFloatParameter upperHemisphereLuxValue = new MinFloatParameter(1.0f, 0.0f);
[Tooltip("Lux intensity multiplier for the sky")]
public FloatParameter desiredLuxValue = new FloatParameter(20000);
[Tooltip("Specify how the environment lighting should be updated.")]
public EnvUpdateParameter updateMode = new EnvUpdateParameter(EnvironementUpdateMode.OnChanged);
[Tooltip("If environment update is set to realtime, period in seconds at which it is updated (0.0 means every frame).")]

hash = hash * 23 + rotation.GetHashCode();
hash = hash * 23 + exposure.GetHashCode();
hash = hash * 23 + multiplier.GetHashCode();
hash = hash * 23 + desiredLuxValue.GetHashCode();
hash = hash * 23 + ((int)skyIntensityMode.value).GetHashCode();
//<<<
hash = hash * 23 + updatePeriod.GetHashCode();

public abstract SkyRenderer CreateRenderer();
}
}
}

3
com.unity.render-pipelines.high-definition/HDRP/Sky/VisualEnvironment.cs


public enum SkyType
{
HDRISky = 1,
ProceduralSky = 2
ProceduralSky = 2,
Gradient = 3,
}
// Keep this class first in the file. Otherwise it seems that the script type is not registered properly.

2
com.unity.render-pipelines.high-definition/package.json


"unity": "2018.2",
"displayName": "HD Render Pipeline",
"dependencies": {
"com.unity.postprocessing": "2.0.10-preview",
"com.unity.postprocessing": "2.0.9-preview",
"com.unity.render-pipelines.core": "3.0.1-preview",
"com.unity.shadergraph": "3.0.1-preview"
}

2
com.unity.render-pipelines.lightweight/package.json


"unity": "2018.2",
"displayName": "Lightweight Render Pipeline",
"dependencies": {
"com.unity.postprocessing": "2.0.10-preview",
"com.unity.postprocessing": "2.0.9-preview",
"com.unity.render-pipelines.core": "3.0.1-preview",
"com.unity.shadergraph": "3.0.1-preview"
}

2
com.unity.testframework.graphics/package.json


{
"name": "com.unity.testframework.graphics",
"displayName":"Graphics Tests Framework",
"version": "0.1.1-preview",
"version": "3.0.1-preview",
"unity": "2018.2",
"description": "Provides test framework helpers for writing tests for graphics code, such as image comparison assertions and automatic management of reference images.",
"keywords": ["qa", "test", "testing", "tests", "graphics"],

8
com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/GradientSky.meta


fileFormatVersion: 2
guid: d02d7d4257904854f91435453078fd44
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs.orig
文件差异内容过多而无法显示
查看文件

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


using UnityEngine.Rendering;
using UnityEngine.Serialization;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
[ExecuteInEditMode]
public abstract class HDProbe : MonoBehaviour, ISerializationCallbackReceiver
{
[SerializeField, FormerlySerializedAs("proxyVolumeComponent"), FormerlySerializedAs("m_ProxyVolumeReference")]
ReflectionProxyVolumeComponent m_ProxyVolume = null;
[SerializeField]
InfluenceVolume m_InfluenceVolume;
[SerializeField, FormerlySerializedAsAttribute("dimmer"), FormerlySerializedAsAttribute("m_Dimmer"), FormerlySerializedAsAttribute("multiplier")]
float m_Multiplier = 1.0f;
[SerializeField, FormerlySerializedAsAttribute("weight")]
[Range(0.0f, 1.0f)]
float m_Weight = 1.0f;
[SerializeField]
ReflectionProbeMode m_Mode = ReflectionProbeMode.Baked;
[SerializeField]
ReflectionProbeRefreshMode m_RefreshMode = ReflectionProbeRefreshMode.OnAwake;
/// <summary>ProxyVolume currently used by this probe.</summary>
public ReflectionProxyVolumeComponent proxyVolume { get { return m_ProxyVolume; } }
/// <summary>InfluenceVolume of the probe.</summary>
public InfluenceVolume influenceVolume { get { return m_InfluenceVolume; } private set { m_InfluenceVolume = value; } }
/// <summary>Multiplier factor of reflection (non PBR parameter).</summary>
public float multiplier { get { return m_Multiplier; } }
/// <summary>Weight for blending amongst probes (non PBR parameter).</summary>
public float weight { get { return m_Weight; } }
/// <summary>The capture mode.</summary>
public virtual ReflectionProbeMode mode
{
get { return m_Mode; }
set { m_Mode = value; }
}
/// <summary>Refreshing rate of the capture for Realtime capture mode.</summary>
public virtual ReflectionProbeRefreshMode refreshMode
{
get { return m_RefreshMode; }
set { m_RefreshMode = value; }
}
<<<<<<< HEAD
void Awake()
=======
internal void Awake()
>>>>>>> HDRP/staging
{
if (influenceVolume == null)
influenceVolume = new InfluenceVolume();
influenceVolume.Init(this);
}
void ISerializationCallbackReceiver.OnBeforeSerialize()
{
}
void ISerializationCallbackReceiver.OnAfterDeserialize()
{
influenceVolume.Init(this);
}
internal virtual void UpdatedInfluenceVolumeShape(Vector3 size, Vector3 offset) { }
}
}

8
com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky.meta


fileFormatVersion: 2
guid: 4eaf64d2d64c8fb45b1e85eefff62dd7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

88
com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/IntegrateHDRISky.shader


Shader "Hidden/HDRenderPipeline/IntegrateHDRI"
{
Properties
{
[HideInInspector]
_Cubemap ("", CUBE) = "white" {}
}
SubShader
{
Tags{ "RenderPipeline" = "HDRenderPipeline" }
Pass
{
ZTest Always Cull Off ZWrite Off
HLSLPROGRAM
#pragma vertex Vert
#pragma fragment Frag
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "CoreRP/ShaderLibrary/Color.hlsl"
#include "CoreRP/ShaderLibrary/ImageBasedLighting.hlsl"
#include "../../ShaderVariables.hlsl"
struct Attributes
{
uint vertexID : SV_VertexID;
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float2 texCoord : TEXCOORD0;
};
TextureCube<float4> _Cubemap;
Varyings Vert(Attributes input)
{
Varyings output;
output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID);
output.texCoord = GetFullScreenTriangleTexCoord(input.vertexID);
return output;
}
// With HDRI that have a large range (including the sun) it can be challenging to
// compute the lux value without multiple importance sampling.
// We instead use a brute force Uniforme Spherical integration of the upper hemisphere
// with a large number of sample. This is fine as this happen in the editor.
real GetUpperHemisphereLuxValue(TEXTURECUBE_ARGS(skybox, sampler_skybox), real3 N)
{
float sum = 0.0;
float dphi = 0.005;
float dtheta = 0.005;
for (float phi = 0; phi < 2.0 * PI; phi += dphi)
{
for (float theta = 0; theta < PI / 2.0; theta += dtheta)
{
// SphericalToCartesian function is for Z up, lets move to Y up with TransformGLtoDX
float3 L = TransformGLtoDX(SphericalToCartesian(phi, cos(theta)));
real val = Luminance(SAMPLE_TEXTURECUBE_LOD(skybox, sampler_skybox, L, 0).rgb);
sum += cos(theta) * sin(theta) * val;
}
}
sum *= dphi * dtheta;
return sum;
}
float4 Frag(Varyings input) : SV_Target
{
// Integrate upper hemisphere (Y up)
float3 N = float3(0.0, 1.0, 0.0);
float intensity = GetUpperHemisphereLuxValue(TEXTURECUBE_PARAM(_Cubemap, s_trilinear_clamp_sampler), N);
return float4(intensity, 1.0, 1.0, 1.0);
}
ENDHLSL
}
}
Fallback Off
}

9
com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/IntegrateHDRISky.shader.meta


fileFormatVersion: 2
guid: 48db2705cf2856d4e893eb30a6892d1b
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

42
com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/GradientSky/GradientSkyEditor.cs


using UnityEngine;
using UnityEditor;
using UnityEngine.Experimental.Rendering.HDPipeline;
namespace UnityEditor.Experimental.Rendering.HDPipeline
{
[CanEditMultipleObjects]
[VolumeComponentEditor(typeof(GradientSky))]
public class GradientSkySettingsEditor : SkySettingsEditor
{
SerializedDataParameter m_Bottom;
SerializedDataParameter m_Middle;
SerializedDataParameter m_Top;
SerializedDataParameter m_GradientMultiplier;
public override void OnEnable()
{
base.OnEnable();
var o = new PropertyFetcher<GradientSky>(serializedObject);
m_Bottom = Unpack(o.Find(x => x.bottom));
m_Middle = Unpack(o.Find(x => x.middle));
m_Top = Unpack(o.Find(x => x.top));
m_GradientMultiplier = Unpack(o.Find(x => x.gradientDiffusion));
}
public override void OnInspectorGUI()
{
PropertyField(m_Top);
PropertyField(m_Middle);
PropertyField(m_Bottom);
PropertyField(m_GradientMultiplier);
EditorGUILayout.Space();
m_CommonUIElementsMask = (uint)SkySettingsUIElement.UpdateMode;
base.CommonSkySettingsGUI();
}
}
}

11
com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/GradientSky/GradientSkyEditor.cs.meta


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

32
com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.cs


namespace UnityEngine.Experimental.Rendering.HDPipeline
{
[SkyUniqueID((int)SkyType.Gradient)]
public class GradientSky : SkySettings
{
public ColorParameter top = new ColorParameter(Color.blue, true, false, true);
public ColorParameter middle = new ColorParameter(new Color(0.3f, 0.7f, 1f), true, false, true);
public ColorParameter bottom = new ColorParameter(Color.white, true, false, true);
public FloatParameter gradientDiffusion = new FloatParameter(1);
public override SkyRenderer CreateRenderer()
{
return new GradientSkyRenderer(this);
}
public override int GetHashCode()
{
int hash = base.GetHashCode();
unchecked
{
hash = 13;
hash = hash * 23 + bottom.GetHashCode();
hash = hash * 23 + top.GetHashCode();
hash = hash * 23 + middle.GetHashCode();
hash = hash * 23 + gradientDiffusion.GetHashCode();
}
return hash;
}
}
}

11
com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.cs.meta


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

9
com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.shader.meta


fileFormatVersion: 2
guid: 2b5d4f1b26f03dc4a873b093e0c4adb1
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

63
com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSkyRenderer.cs


using UnityEngine.Rendering;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
public class GradientSkyRenderer : SkyRenderer
{
Material m_GradientSkyMaterial; // Renders a cubemap into a render texture (can be cube or 2D)
MaterialPropertyBlock m_PropertyBlock;
GradientSky m_GradientSkyParams;
readonly int _GradientBottom = Shader.PropertyToID("_GradientBottom");
readonly int _GradientMiddle = Shader.PropertyToID("_GradientMiddle");
readonly int _GradientTop = Shader.PropertyToID("_GradientTop");
readonly int _GradientDiffusion = Shader.PropertyToID("_GradientDiffusion");
public GradientSkyRenderer(GradientSky GradientSkyParams)
{
m_GradientSkyParams = GradientSkyParams;
m_PropertyBlock = new MaterialPropertyBlock();
}
public override void Build()
{
var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;
m_GradientSkyMaterial = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.gradientSky);
}
public override void Cleanup()
{
CoreUtils.Destroy(m_GradientSkyMaterial);
}
public override void SetRenderTargets(BuiltinSkyParameters builtinParams)
{
if (builtinParams.depthBuffer == BuiltinSkyParameters.nullRT)
{
HDUtils.SetRenderTarget(builtinParams.commandBuffer, builtinParams.hdCamera, builtinParams.colorBuffer);
}
else
{
HDUtils.SetRenderTarget(builtinParams.commandBuffer, builtinParams.hdCamera, builtinParams.colorBuffer, builtinParams.depthBuffer);
}
}
public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderForCubemap, bool renderSunDisk)
{
m_GradientSkyMaterial.SetColor(_GradientBottom, m_GradientSkyParams.bottom);
m_GradientSkyMaterial.SetColor(_GradientMiddle, m_GradientSkyParams.middle);
m_GradientSkyMaterial.SetColor(_GradientTop, m_GradientSkyParams.top);
m_GradientSkyMaterial.SetFloat(_GradientDiffusion, m_GradientSkyParams.gradientDiffusion);
// This matrix needs to be updated at the draw call frequency.
m_PropertyBlock.SetMatrix(HDShaderIDs._PixelCoordToViewDirWS, builtinParams.pixelCoordToViewDirMatrix);
CoreUtils.DrawFullScreen(builtinParams.commandBuffer, m_GradientSkyMaterial, m_PropertyBlock, renderForCubemap ? 0 : 1);
}
public override bool IsValid()
{
return m_GradientSkyParams != null && m_GradientSkyMaterial != null;
}
}
}

11
com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSkyRenderer.cs.meta


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

81
com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.shader


Shader "Hidden/HDRenderPipeline/Sky/GradientSky"
{
HLSLINCLUDE
#pragma vertex Vert
#pragma fragment Frag
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "CoreRP/ShaderLibrary/Color.hlsl"
#include "CoreRP/ShaderLibrary/CommonLighting.hlsl"
#include "HDRP/ShaderVariables.hlsl"
float4x4 _PixelCoordToViewDirWS; // Actually just 3x3, but Unity can only set 4x4
float4 _GradientBottom;
float4 _GradientMiddle;
float4 _GradientTop;
float _GradientDiffusion;
struct Attributes
{
uint vertexID : SV_VertexID;
};
struct Varyings
{
float4 positionCS : SV_POSITION;
};
Varyings Vert(Attributes input)
{
Varyings output;
output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID, UNITY_RAW_FAR_CLIP_VALUE);
return output;
}
float4 Frag(Varyings input) : SV_Target
{
float3 viewDirWS = normalize(mul(float3(input.positionCS.xy, 1.0), (float3x3)_PixelCoordToViewDirWS));
float verticalGradient = viewDirWS.y * _GradientDiffusion;
float topLerpFactor = saturate(-verticalGradient);
float bottomLerpFactor = saturate(verticalGradient);
float3 color = lerp(_GradientMiddle.xyz, _GradientBottom.xyz, bottomLerpFactor);
color = lerp(color, _GradientTop.xyz, topLerpFactor);
return float4 (color, 1.0);
}
ENDHLSL
SubShader
{
Pass
{
ZWrite Off
ZTest Always
Blend Off
Cull Off
HLSLPROGRAM
ENDHLSL
}
Pass
{
ZWrite Off
ZTest LEqual
Blend Off
Cull Off
HLSLPROGRAM
ENDHLSL
}
}
Fallback Off
}

8
com.unity.render-pipelines.high-definition/HDRP/Sky/AtmosphericScattering.meta


fileFormatVersion: 2
guid: d522828bc0314e14cb6faa4291bb64da
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存