sebastienlagarde
7 年前
当前提交
10164527
共有 47 个文件被更改,包括 1685 次插入 和 67 次删除
-
4.gitmodules
-
1TestProjects/HDRP_Tests/Packages/manifest.json
-
1TestProjects/LWGraphicsTest/Packages/manifest.json
-
2TestProjects/PostProcessing/Packages/manifest.json
-
1TestProjects/ShaderGraph/Packages/manifest.json
-
6build.py
-
16com.unity.render-pipelines.core/CoreRP/Textures/TextureCache.cs
-
3com.unity.render-pipelines.high-definition/CHANGELOG.md
-
11com.unity.render-pipelines.high-definition/HDRP/Debug/DebugDisplay.cs
-
5com.unity.render-pipelines.high-definition/HDRP/Debug/LightingDebug.cs
-
4com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/HDAssetFactory.cs
-
81com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/HDRISky/HDRISkyEditor.cs
-
10com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/SkySettingsEditor.cs
-
10com.unity.render-pipelines.high-definition/HDRP/HDRenderPipelineAsset.asset
-
13com.unity.render-pipelines.high-definition/HDRP/Lighting/LightDefinition.cs
-
49com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs
-
2com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs
-
4com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ProbeWrapper.cs
-
2com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs
-
1com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDStringConstants.cs
-
2com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/HDRenderPipelineResources.asset
-
2com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/RenderPipelineResources.cs
-
2com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/HDRISky.shader
-
21com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/HDRISkyRenderer.cs
-
2com.unity.render-pipelines.high-definition/HDRP/Sky/SkyRenderingContext.cs
-
31com.unity.render-pipelines.high-definition/HDRP/Sky/SkySettings.cs
-
3com.unity.render-pipelines.high-definition/HDRP/Sky/VisualEnvironment.cs
-
2com.unity.render-pipelines.high-definition/package.json
-
2com.unity.render-pipelines.lightweight/package.json
-
2com.unity.testframework.graphics/package.json
-
8com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/GradientSky.meta
-
1001com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs.orig
-
75com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs.orig
-
8com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky.meta
-
88com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/IntegrateHDRISky.shader
-
9com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/IntegrateHDRISky.shader.meta
-
42com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/GradientSky/GradientSkyEditor.cs
-
11com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/GradientSky/GradientSkyEditor.cs.meta
-
32com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.cs
-
11com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.cs.meta
-
9com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.shader.meta
-
63com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSkyRenderer.cs
-
11com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSkyRenderer.cs.meta
-
81com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.shader
-
8com.unity.render-pipelines.high-definition/HDRP/Sky/AtmosphericScattering.meta
|
|||
[submodule "com.unity.postprocessing"] |
|||
path = com.unity.postprocessing |
|||
url = https://github.com/Unity-Technologies/PostProcessing.git |
|||
branch = v2 |
|
|||
fileFormatVersion: 2 |
|||
guid: d02d7d4257904854f91435453078fd44 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1001
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.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) { } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4eaf64d2d64c8fb45b1e85eefff62dd7 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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 |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 48db2705cf2856d4e893eb30a6892d1b |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8d9ef3fb3b5232a4abaebf916d7a1108 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: a81bcacc415a1f743bfdf703afc52027 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 2b5d4f1b26f03dc4a873b093e0c4adb1 |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 932fb63537938154fbe7249e1bbeb2e3 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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 |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: d522828bc0314e14cb6faa4291bb64da |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue