您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
71 行
2.0 KiB
71 行
2.0 KiB
Pass
|
|
{
|
|
Name "Sprite Normal"
|
|
Tags { "LightMode" = "NormalsRendering" }
|
|
|
|
${Tags}
|
|
${Blending}
|
|
${Culling}
|
|
ZWrite Off
|
|
|
|
HLSLPROGRAM
|
|
// Required to compile gles 2.0 with standard srp library
|
|
#pragma prefer_hlslcc gles
|
|
#pragma exclude_renderers d3d11_9x
|
|
#pragma target 2.0
|
|
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
#pragma multi_compile _ ETC1_EXTERNAL_ALPHA
|
|
|
|
${Defines}
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/NormalsRenderingShared.hlsl"
|
|
|
|
#if ETC1_EXTERNAL_ALPHA
|
|
TEXTURE2D(_AlphaTex); SAMPLER(sampler_AlphaTex);
|
|
float _EnableAlphaTexture;
|
|
#endif
|
|
|
|
${Graph}
|
|
struct GraphVertexOutput
|
|
{
|
|
float4 position : POSITION;
|
|
float3 normalWS : TEXCOORD0;
|
|
float3 bitangentWS : TEXCOORD1;
|
|
${VertexOutputStruct}
|
|
};
|
|
|
|
GraphVertexOutput vert (GraphVertexInput v)
|
|
{
|
|
GraphVertexOutput o = (GraphVertexOutput)0;
|
|
${VertexShader}
|
|
VertexDescriptionInputs vdi = (VertexDescriptionInputs)0;
|
|
${VertexShaderDescriptionInputs}
|
|
VertexDescription vd = PopulateVertexData(vdi);
|
|
|
|
v.vertex.xyz = vd.Position;
|
|
o.position = TransformObjectToHClip(v.vertex.xyz);
|
|
o.normalWS = TransformObjectToWorldDir(float3(0, 0, -1));
|
|
o.bitangentWS = cross(o.normalWS, WorldSpaceTangent) * v.tangent.w;
|
|
${VertexShaderOutputs}
|
|
return o;
|
|
}
|
|
|
|
half4 frag (GraphVertexOutput IN) : SV_Target
|
|
{
|
|
${PixelShader}
|
|
SurfaceDescriptionInputs surfaceInput = (SurfaceDescriptionInputs)0;
|
|
${PixelShaderSurfaceInputs}
|
|
SurfaceDescription surf = PopulateSurfaceData(surfaceInput);
|
|
|
|
return NormalsRenderingShared(surf.Color, surf.Normal, WorldSpaceTangent, IN.bitangentWS, IN.normalWS);
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|
|
|