Paul Melamed
6 年前
当前提交
5f083851
共有 9 个文件被更改,包括 256 次插入 和 8 次删除
-
3com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/HDAssetFactory.cs
-
147com.unity.render-pipelines.high-definition/HDRP/Material/Decal/Decal.shader
-
2com.unity.render-pipelines.high-definition/HDRP/Material/GBufferManager.cs
-
8com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.shader
-
1com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDCustomSamplerId.cs
-
14com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs
-
3com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/RenderPipelineResources.cs
-
77com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalNormalBuffer.shader
-
9com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalNormalBuffer.shader.meta
|
|||
Shader "Hidden/HDRenderPipeline/Material/Decal/DecalNormalBuffer" |
|||
{ |
|||
HLSLINCLUDE |
|||
|
|||
#pragma target 4.5 |
|||
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch |
|||
#include "CoreRP/ShaderLibrary/Common.hlsl" |
|||
#include "../../ShaderVariables.hlsl" |
|||
#include "Decal.hlsl" |
|||
#include "../NormalBuffer.hlsl" |
|||
|
|||
TEXTURE2D(_DBufferTexture1); |
|||
RW_TEXTURE2D(float4, _NormalBuffer); |
|||
|
|||
|
|||
SamplerState sampler_PointClamp; |
|||
|
|||
struct Attributes |
|||
{ |
|||
uint vertexID : SV_VertexID; |
|||
}; |
|||
|
|||
struct Varyings |
|||
{ |
|||
float4 positionCS : SV_POSITION; |
|||
float2 texcoord : TEXCOORD0; |
|||
}; |
|||
|
|||
Varyings Vert(Attributes input) |
|||
{ |
|||
Varyings output; |
|||
output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID); |
|||
output.texcoord = GetFullScreenTriangleTexCoord(input.vertexID);// *_BlitScaleBias.xy + _BlitScaleBias.zw; |
|||
return output; |
|||
} |
|||
|
|||
float4 FragNearest(Varyings input) : SV_Target |
|||
{ |
|||
float4 DBufferNormal = SAMPLE_TEXTURE2D(_DBufferTexture1, sampler_PointClamp, input.texcoord) * float4(2.0f, 2.0f, 2.0f, 1.0f) - float4(1.0f, 1.0f, 1.0f, 0.0f); |
|||
float4 GBufferNormal = _NormalBuffer[input.texcoord * _ScreenSize.xy]; |
|||
NormalData normalData; |
|||
DecodeFromNormalBuffer(GBufferNormal, uint2(0, 0), normalData); |
|||
normalData.normalWS.xyz = normalize(normalData.normalWS.xyz * DBufferNormal.w + DBufferNormal.xyz); |
|||
EncodeIntoNormalBuffer(normalData, uint2(0, 0), GBufferNormal); |
|||
_NormalBuffer[input.texcoord * _ScreenSize.xy] = GBufferNormal; |
|||
return GBufferNormal; |
|||
} |
|||
|
|||
ENDHLSL |
|||
|
|||
SubShader |
|||
{ |
|||
Tags{ "RenderPipeline" = "HDRenderPipeline" } |
|||
|
|||
Pass |
|||
{ |
|||
ZWrite Off |
|||
ZTest Always |
|||
Blend Off |
|||
Cull Off |
|||
Stencil |
|||
{ |
|||
WriteMask 255 |
|||
Ref 2 |
|||
Comp Equal |
|||
Pass Zero |
|||
} |
|||
|
|||
HLSLPROGRAM |
|||
#pragma vertex Vert |
|||
#pragma fragment FragNearest |
|||
ENDHLSL |
|||
} |
|||
} |
|||
|
|||
Fallback Off |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: fd532bf1795188c4daaa66ea798b8b0a |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue