浏览代码
Merge branch 'master' into lw/bugfixes
Merge branch 'master' into lw/bugfixes
# Conflicts: # com.unity.render-pipelines.lightweight/CHANGELOG.md/main
Felipe Lira
7 年前
当前提交
7193e88e
共有 83 个文件被更改,包括 973 次插入 和 291 次删除
-
5com.unity.render-pipelines.core/CoreRP/Editor/ShaderGenerator/ShaderTypeGeneration.cs
-
2com.unity.render-pipelines.core/CoreRP/ShaderLibrary/Common.hlsl
-
5com.unity.render-pipelines.core/CoreRP/ShaderLibrary/CommonMaterial.hlsl
-
35com.unity.render-pipelines.high-definition/CHANGELOG.md
-
5com.unity.render-pipelines.high-definition/HDRP/Debug/ColorPickerDebug.cs
-
24com.unity.render-pipelines.high-definition/HDRP/Debug/DebugColorPicker.shader
-
33com.unity.render-pipelines.high-definition/HDRP/Debug/DebugDisplay.cs
-
1com.unity.render-pipelines.high-definition/HDRP/Debug/DebugViewMaterialGBuffer.shader
-
1com.unity.render-pipelines.high-definition/HDRP/Debug/DebugViewTiles.shader
-
1com.unity.render-pipelines.high-definition/HDRP/Debug/LightingDebug.cs
-
9com.unity.render-pipelines.high-definition/HDRP/Debug/LightingDebug.cs.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.Styles.cs
-
18com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/ReflectionMenuItem.cs
-
3com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Decal/DecalProjectorComponentEditor.cs
-
25com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Decal/DecalUI.cs
-
16com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Lit/LitShaderPreprocessor.cs
-
2com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDPBRPass.template
-
4com.unity.render-pipelines.high-definition/HDRP/Editor/Upgraders/HDRPVersion.cs
-
21com.unity.render-pipelines.high-definition/HDRP/HDRenderPipelineAsset.asset
-
24com.unity.render-pipelines.high-definition/HDRP/Lighting/DeferredDirectionalShadow.compute
-
8com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs
-
4com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DBufferManager.cs
-
15com.unity.render-pipelines.high-definition/HDRP/Material/Decal/Decal.cs
-
1com.unity.render-pipelines.high-definition/HDRP/Material/Decal/Decal.cs.hlsl
-
32com.unity.render-pipelines.high-definition/HDRP/Material/Decal/Decal.shader
-
43com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalData.hlsl
-
9com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalProjectorComponent.cs
-
1com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalProperties.hlsl
-
90com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalSystem.cs
-
24com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalUtilities.hlsl
-
12com.unity.render-pipelines.high-definition/HDRP/Material/Decal/ShaderPass/DecalSharePass.hlsl
-
12com.unity.render-pipelines.high-definition/HDRP/Material/LayeredLit/LayeredLit.shader
-
12com.unity.render-pipelines.high-definition/HDRP/Material/LayeredLit/LayeredLitTessellation.shader
-
112com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.hlsl
-
12com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.shader
-
2com.unity.render-pipelines.high-definition/HDRP/Material/Lit/LitBuiltinData.hlsl
-
12com.unity.render-pipelines.high-definition/HDRP/Material/Lit/LitTessellation.shader
-
2com.unity.render-pipelines.high-definition/HDRP/Material/Lit/ShaderPass/LitDepthPass.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/Material/Lit/ShaderPass/LitDistortionPass.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/Material/Lit/ShaderPass/LitSharePass.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/Material/Lit/ShaderPass/LitVelocityPass.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/ShaderPass/StackLitDepthPass.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/ShaderPass/StackLitDistortionPass.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/ShaderPass/StackLitSharePass.hlsl
-
38com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/StackLit.hlsl
-
4com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/StackLit.shader
-
2com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/StackLitData.hlsl
-
4com.unity.render-pipelines.high-definition/HDRP/Material/SubsurfaceScattering/SubsurfaceScattering.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/Material/Unlit/ShaderPass/UnlitDepthPass.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/Material/Unlit/ShaderPass/UnlitDistortionPass.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/Material/Unlit/ShaderPass/UnlitSharePass.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/Material/Unlit/Unlit.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/Material/Unlit/Unlit.shader
-
106com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs
-
13com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDStringConstants.cs
-
10com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/CameraMotionVectors.shader
-
3com.unity.render-pipelines.high-definition/HDRP/ShaderPass/ShaderPass.cs
-
3com.unity.render-pipelines.high-definition/HDRP/ShaderPass/ShaderPass.cs.hlsl
-
30com.unity.render-pipelines.high-definition/HDRP/ShaderPass/ShaderPassDBuffer.hlsl
-
15com.unity.render-pipelines.high-definition/HDRP/ShaderPass/ShaderPassDepthOnly.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/ShaderPass/ShaderPassForward.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/ShaderPass/ShaderPassForwardUnlit.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/ShaderPass/ShaderPassGBuffer.hlsl
-
2com.unity.render-pipelines.high-definition/HDRP/ShaderPass/ShaderPassLightTransport.hlsl
-
14com.unity.render-pipelines.lightweight/LWRP/Editor/ShaderGraph/lightweightPBRExtraPasses.template
-
11com.unity.render-pipelines.lightweight/LWRP/Editor/ShaderGraph/lightweightPBRForwardPass.template
-
14com.unity.render-pipelines.lightweight/LWRP/Editor/ShaderGraph/lightweightUnlitExtraPasses.template
-
11com.unity.render-pipelines.lightweight/LWRP/Editor/ShaderGraph/lightweightUnlitPass.template
-
6com.unity.render-pipelines.lightweight/LWRP/LightweightForwardRenderer.cs
-
3com.unity.render-pipelines.lightweight/LWRP/Shaders/LightweightScreenSpaceShadows.shader
-
2com.unity.render-pipelines.lightweight/LWRP/Shaders/Terrain/LightweightStandardTerrain.shader
-
6com.unity.render-pipelines.lightweight/LWRP/Shaders/Terrain/LightweightStandardTerrainBase.shader
-
82com.unity.shadergraph/Editor/Data/Nodes/Utility/Logic/IsFrontFaceNode.cs
-
5com.unity.shadergraph/Editor/Data/Util/PropertyCollector.cs
-
5com.unity.shadergraph/Editor/Data/Util/ShaderGenerator.cs
-
11CONTRIBUTING
-
21com.unity.render-pipelines.high-definition/HDRP/Debug/FalseColorDebug.cs
-
11com.unity.render-pipelines.high-definition/HDRP/Debug/FalseColorDebug.cs.meta
-
55com.unity.render-pipelines.high-definition/HDRP/Material/NormalBuffer.hlsl
-
9com.unity.render-pipelines.high-definition/HDRP/Material/NormalBuffer.hlsl.meta
-
81com.unity.render-pipelines.high-definition/HDRP/Material/NormalBufferManager.cs
-
11com.unity.render-pipelines.high-definition/HDRP/Material/NormalBufferManager.cs.meta
-
9issue_template.md
|
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Utility", "Logic", "Is Front Face")] |
|||
public class IsFrontFaceNode : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireFaceSign |
|||
{ |
|||
public IsFrontFaceNode() |
|||
{ |
|||
name = "Is Front Face"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public override string documentationURL |
|||
{ |
|||
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Is-Front-Face-Node"; } |
|||
} |
|||
|
|||
public override bool hasPreview { get { return false; } } |
|||
|
|||
public const int OutputSlotId = 0; |
|||
private const string kOutputSlotName = "Out"; |
|||
|
|||
public override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new BooleanMaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, true, ShaderStageCapability.Fragment)); |
|||
RemoveSlotsNameNotMatching(new[] { OutputSlotId }); |
|||
} |
|||
|
|||
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
visitor.AddShaderChunk(string.Format("{0} {1} = max(0, IN.{2});", precision, GetVariableNameForSlot(OutputSlotId), ShaderGeneratorNames.FaceSign), true); |
|||
} |
|||
|
|||
public bool RequiresFaceSign(ShaderStageCapability stageCapability = ShaderStageCapability.Fragment) |
|||
{ |
|||
return true; |
|||
} |
|||
} |
|||
} |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Utility", "Logic", "Is Front Face")] |
|||
public class IsFrontFaceNode : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireFaceSign |
|||
{ |
|||
public IsFrontFaceNode() |
|||
{ |
|||
name = "Is Front Face"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public override string documentationURL |
|||
{ |
|||
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Is-Front-Face-Node"; } |
|||
} |
|||
|
|||
public override bool hasPreview { get { return false; } } |
|||
|
|||
public const int OutputSlotId = 0; |
|||
private const string kOutputSlotName = "Out"; |
|||
|
|||
public override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new BooleanMaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, true, ShaderStageCapability.Fragment)); |
|||
RemoveSlotsNameNotMatching(new[] { OutputSlotId }); |
|||
} |
|||
|
|||
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
visitor.AddShaderChunk(string.Format("{0} {1} = max(0, IN.{2});", precision, GetVariableNameForSlot(OutputSlotId), ShaderGeneratorNames.FaceSign), true); |
|||
} |
|||
|
|||
public bool RequiresFaceSign(ShaderStageCapability stageCapability = ShaderStageCapability.Fragment) |
|||
{ |
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
# PR review process |
|||
|
|||
- Any PR must have an entry in the corresponding changelog in a separate commit (CHANGELOG.MD file) |
|||
- Changelog follow these guidelines: https://github.com/Unity-Technologies/PostProcessing/blob/v2/CHANGELOG.md |
|||
- Each release branch (2018.1, 2018.2...) have a unique Changelog file |
|||
- when backporting, don't backport the changelog commit but update the branch changelog manually |
|||
- (optional) add reviewver from doc team |
|||
- Any more complex description of a change with future need to go in a release note file |
|||
|
|||
|
|||
|
|
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using System; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[Serializable] |
|||
public class FalseColorDebugSettings |
|||
{ |
|||
public bool falseColor = false; |
|||
|
|||
public float colorThreshold0 = 0.0f; |
|||
public float colorThreshold1 = 2.0f; |
|||
public float colorThreshold2 = 10.0f; |
|||
public float colorThreshold3 = 20.0f; |
|||
|
|||
public void OnValidate() |
|||
{ |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8fc313e69425fb44c8fa18af3761ec24 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#include "CoreRP/ShaderLibrary/Packing.hlsl" |
|||
#include "CoreRP/ShaderLibrary/CommonMaterial.hlsl" |
|||
|
|||
// ---------------------------------------------------------------------------- |
|||
// Encoding/decoding normal buffer functions |
|||
// ---------------------------------------------------------------------------- |
|||
|
|||
struct NormalData |
|||
{ |
|||
float3 normalWS; |
|||
float perceptualRoughness; |
|||
}; |
|||
|
|||
#define NormalBufferType0 float4 // Must match GBufferType1 in deferred |
|||
|
|||
// SSSBuffer texture declaration |
|||
TEXTURE2D(_NormalBufferTexture0); |
|||
|
|||
void EncodeIntoNormalBuffer(NormalData normalData, uint2 positionSS, out NormalBufferType0 outNormalBuffer0) |
|||
{ |
|||
// The sign of the Z component of the normal MUST round-trip through the G-Buffer, otherwise |
|||
// the reconstruction of the tangent frame for anisotropic GGX creates a seam along the Z axis. |
|||
// The constant was eye-balled to not cause artifacts. |
|||
// TODO: find a proper solution. E.g. we could re-shuffle the faces of the octahedron |
|||
// s.t. the sign of the Z component round-trips. |
|||
const float seamThreshold = 1.0 / 1024.0; |
|||
normalData.normalWS.z = CopySign(max(seamThreshold, abs(normalData.normalWS.z)), normalData.normalWS.z); |
|||
|
|||
// RT1 - 8:8:8:8 |
|||
// Our tangent encoding is based on our normal. |
|||
float2 octNormalWS = PackNormalOctQuadEncode(normalData.normalWS); |
|||
float3 packNormalWS = PackFloat2To888(saturate(octNormalWS * 0.5 + 0.5)); |
|||
// We store perceptualRoughness instead of roughness because it is perceptually linear. |
|||
outNormalBuffer0 = float4(packNormalWS, normalData.perceptualRoughness); |
|||
} |
|||
|
|||
void DecodeFromNormalBuffer(float4 normalBuffer, uint2 positionSS, out NormalData normalData) |
|||
{ |
|||
float3 packNormalWS = normalBuffer.rgb; |
|||
float2 octNormalWS = Unpack888ToFloat2(packNormalWS); |
|||
normalData.normalWS = UnpackNormalOctQuadEncode(octNormalWS * 2.0 - 1.0); |
|||
normalData.perceptualRoughness = normalBuffer.a; |
|||
} |
|||
|
|||
void DecodeFromNormalBuffer(uint2 positionSS, out NormalData normalData) |
|||
{ |
|||
float4 normalBuffer = LOAD_TEXTURE2D(_NormalBufferTexture0, positionSS); |
|||
DecodeFromNormalBuffer(normalBuffer, positionSS, normalData); |
|||
} |
|||
|
|||
// OUTPUT_NORMAL_NORMALBUFFER start from SV_Target0 as it is used during depth prepass where there is no color buffer |
|||
#define OUTPUT_NORMALBUFFER(NAME) out NormalBufferType0 MERGE_NAME(NAME, 0) : SV_Target0 |
|||
#define ENCODE_INTO_NORMALBUFFER(SURFACE_DATA, UNPOSITIONSS, NAME) EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(SURFACE_DATA), UNPOSITIONSS, MERGE_NAME(NAME, 0)) |
|||
|
|||
#define DECODE_FROM_NORMALBUFFER(UNPOSITIONSS, NORMAL_DATA) DecodeFromNormalBuffer(UNPOSITIONSS, NORMAL_DATA) |
|
|||
fileFormatVersion: 2 |
|||
guid: c575b09819842744aa411a49f5a26660 |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Rendering; |
|||
using System; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
public class NormalBufferManager |
|||
{ |
|||
// Currently we only support NormalBuffer with one buffer. If the shader code change, it may require to update the shader manager
|
|||
public const int k_MaxNormalBuffer = 1; |
|||
|
|||
public int normalBufferCount { get { return k_MaxNormalBuffer; } } |
|||
|
|||
RTHandleSystem.RTHandle[] m_ColorMRTs = new RTHandleSystem.RTHandle[k_MaxNormalBuffer]; |
|||
protected RenderTargetIdentifier[] m_RTIDs = new RenderTargetIdentifier[k_MaxNormalBuffer]; |
|||
bool[] m_ExternalBuffer = new bool[k_MaxNormalBuffer]; |
|||
|
|||
RTHandleSystem.RTHandle m_HTile; |
|||
|
|||
public NormalBufferManager() |
|||
{ |
|||
} |
|||
|
|||
public void InitNormalBuffers(GBufferManager gbufferManager, RenderPipelineSettings settings) |
|||
{ |
|||
if (settings.supportOnlyForward) |
|||
{ |
|||
// In case of full forward we must allocate the render target for normal buffer (or reuse one already existing)
|
|||
// TODO: Provide a way to reuse a render target
|
|||
m_ColorMRTs[0] = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: RenderTextureFormat.ARGB32, sRGB: false, name: "NormalBuffer"); |
|||
m_ExternalBuffer[0] = false; |
|||
} |
|||
else |
|||
{ |
|||
// In case of deferred, we must be in sync with NormalBuffer.hlsl and lit.hlsl files and setup the correct buffers
|
|||
m_ColorMRTs[0] = gbufferManager.GetBuffer(1); // Normal + Roughness is GBuffer(1)
|
|||
m_ExternalBuffer[0] = true; |
|||
} |
|||
} |
|||
|
|||
public RenderTargetIdentifier[] GetBuffersRTI() |
|||
{ |
|||
// nameID can change from one frame to another depending on the msaa flag so so we need to update this array to be sure it's up to date.
|
|||
for (int i = 0; i < normalBufferCount; ++i) |
|||
{ |
|||
m_RTIDs[i] = m_ColorMRTs[i].nameID; |
|||
} |
|||
|
|||
return m_RTIDs; |
|||
} |
|||
|
|||
public RTHandleSystem.RTHandle GetNormalBuffer(int index) |
|||
{ |
|||
Debug.Assert(index < normalBufferCount); |
|||
return m_ColorMRTs[index]; |
|||
} |
|||
|
|||
public void Build(HDRenderPipelineAsset hdAsset) |
|||
{ |
|||
} |
|||
|
|||
public void Cleanup() |
|||
{ |
|||
for (int i = 0; i < k_MaxNormalBuffer; ++i) |
|||
{ |
|||
if (!m_ExternalBuffer[i]) |
|||
{ |
|||
RTHandles.Release(m_ColorMRTs[i]); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public void BindNormalBuffers(CommandBuffer cmd) |
|||
{ |
|||
// NormalBuffer can be access in forward shader, so need to set global texture
|
|||
for (int i = 0; i < normalBufferCount; ++i) |
|||
{ |
|||
cmd.SetGlobalTexture(HDShaderIDs._NormalBufferTexture[i], GetNormalBuffer(i)); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 37fd75386a4957c43b0e2d0311efe2c4 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
##### What happened? |
|||
|
|||
##### Which package (Shader graph, LW, HDRP, Core...)? |
|||
|
|||
##### Unity template or github source code? |
|||
|
|||
##### Which package version or branch (1.1.8-preview, 2.0.0-preview, 2018.1, 2018.1-experiment, 2108.2...)? |
|||
|
|||
##### Unity version, operating system, target platform (standalone windows, mac, iOS, PS4...)? |
撰写
预览
正在加载...
取消
保存
Reference in new issue