Paul Melamed
7 年前
当前提交
c4761310
共有 19 个文件被更改,包括 176 次插入 和 39 次删除
-
23ScriptableRenderPipeline/HDRenderPipeline/Decal/DecalSystem.cs
-
6ScriptableRenderPipeline/HDRenderPipeline/Decal/DecalComponent.cs
-
7ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
-
3ScriptableRenderPipeline/HDRenderPipeline/HDStringConstants.cs
-
6ScriptableRenderPipeline/HDRenderPipeline/Material/Decal/Decal.hlsl
-
15ScriptableRenderPipeline/HDRenderPipeline/Material/Decal/Decal.shader
-
9ScriptableRenderPipeline/HDRenderPipeline/Material/Decal/DecalProperties.hlsl
-
8ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitDataInternal.hlsl
-
9ScriptableRenderPipeline/HDRenderPipeline/Material/Material.hlsl
-
21ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPassDBuffer.hlsl
-
1ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPassGBuffer.hlsl
-
7ScriptableRenderPipeline/HDRenderPipeline/ShaderVariables.hlsl
-
22ScriptableRenderPipeline/HDRenderPipeline/Material/Decal/Decal.cs
-
39ScriptableRenderPipeline/HDRenderPipeline/Material/Decal/Decal.cs.hlsl
-
23ScriptableRenderPipeline/HDRenderPipeline/Material/Decal/DecalData.hlsl
-
7ScriptableRenderPipeline/HDRenderPipeline/Material/Decal/ShaderPass/DecalSharePass.hlsl
-
9ScriptableRenderPipeline/HDRenderPipeline/Material/Decal/OutputBuffers.hlsl
-
0/ScriptableRenderPipeline/HDRenderPipeline/Decal/DecalComponent.cs
|
|||
CBUFFER_START(Decal) |
|||
float4x4 _WorldToDecal; |
|||
CBUFFER_END |
|||
#include "Decal.cs.hlsl" |
|||
|
|||
#define DBufferType0 float4 |
|
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
public partial class Decal : RenderPipelineMaterial |
|||
{ |
|||
// Main structure that store the user data (i.e user input of master node in material graph)
|
|||
[GenerateHLSL(PackingRules.Exact, false, true, 2000)] |
|||
public struct SurfaceData |
|||
{ |
|||
[SurfaceDataAttributes("Base Color", false, true)] |
|||
public Vector4 baseColor; |
|||
[SurfaceDataAttributes("Normal", true)] |
|||
public Vector4 normalWS; |
|||
}; |
|||
|
|||
[GenerateHLSL(PackingRules.Exact, false, true, 2100)] |
|||
public struct BSDFData |
|||
{ |
|||
}; |
|||
} |
|||
} |
|
|||
// |
|||
// This file was automatically generated. Please don't edit by hand. |
|||
// |
|||
|
|||
#ifndef DECAL_CS_HLSL |
|||
#define DECAL_CS_HLSL |
|||
// |
|||
// UnityEngine.Experimental.Rendering.HDPipeline.Decal+SurfaceData: static fields |
|||
// |
|||
#define DEBUGVIEW_DECAL_SURFACEDATA_BASE_COLOR (2000) |
|||
#define DEBUGVIEW_DECAL_SURFACEDATA_NORMAL_WS (2001) |
|||
|
|||
// Generated from UnityEngine.Experimental.Rendering.HDPipeline.Decal+SurfaceData |
|||
// PackingRules = Exact |
|||
struct SurfaceData |
|||
{ |
|||
float4 baseColor; |
|||
float4 normalWS; |
|||
}; |
|||
|
|||
// |
|||
// Debug functions |
|||
// |
|||
void GetGeneratedSurfaceDataDebug(uint paramId, SurfaceData surfacedata, inout float3 result, inout bool needLinearToSRGB) |
|||
{ |
|||
switch (paramId) |
|||
{ |
|||
case DEBUGVIEW_DECAL_SURFACEDATA_BASE_COLOR: |
|||
result = surfacedata.baseColor.xyz; |
|||
needLinearToSRGB = true; |
|||
break; |
|||
case DEBUGVIEW_DECAL_SURFACEDATA_NORMAL_WS: |
|||
result = surfacedata.normalWS.xyz; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
|
|||
#endif |
|
|||
//------------------------------------------------------------------------------------- |
|||
// Fill SurfaceData/Builtin data function |
|||
//------------------------------------------------------------------------------------- |
|||
#include "../../../Core/ShaderLibrary/SampleUVMapping.hlsl" |
|||
#include "../MaterialUtilities.hlsl" |
|||
|
|||
|
|||
void GetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData) |
|||
{ |
|||
float3 positionWS = posInput.positionWS; |
|||
float3 positionDS = mul(_WorldToDecal, float4(positionWS, 1.0f)).xyz; |
|||
clip(positionDS < 0 ? -1 : 1); |
|||
clip(positionDS > 1 ? -1 : 1); |
|||
|
|||
surfaceData.baseColor = SAMPLE_TEXTURE2D(_BaseColorMap, sampler_BaseColorMap, positionDS.xz); |
|||
surfaceData.baseColor.w *= _DecalBlend; |
|||
UVMapping texCoord; |
|||
ZERO_INITIALIZE(UVMapping, texCoord); |
|||
ZERO_INITIALIZE(BuiltinData, builtinData); |
|||
texCoord.uv = positionDS.xz; |
|||
surfaceData.normalWS.xyz = mul((float3x3)_DecalToWorldR, SAMPLE_UVMAPPING_NORMALMAP(_NormalMap, sampler_NormalMap, texCoord, 1)) * 0.5f + 0.5f; |
|||
surfaceData.normalWS.w = surfaceData.baseColor.w; |
|||
} |
|
|||
#ifndef SHADERPASS |
|||
#error Undefine_SHADERPASS |
|||
#endif |
|||
|
|||
|
|||
// This include will define the various Attributes/Varyings structure |
|||
#include "../../ShaderPass/VaryingMesh.hlsl" |
|
|||
#ifndef UNITY_DECALOUTPUTBUFFERS_INCLUDED |
|||
#define UNITY_DECALOUTPUTBUFFERS_INCLUDED |
|||
|
|||
#define DBufferType0 float4 |
|||
|
|||
#define OUTPUT_DBUFFER(NAME) \ |
|||
out DBufferType0 MERGE_NAME(NAME, 0) : SV_Target0 |
|||
|
|||
#endif |
撰写
预览
正在加载...
取消
保存
Reference in new issue