您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
74 行
1.9 KiB
74 行
1.9 KiB
Pass
|
|
{
|
|
Name "Sprite Forward"
|
|
Tags{"LightMode" = "UniversalForward"}
|
|
|
|
${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"
|
|
|
|
#if ETC1_EXTERNAL_ALPHA
|
|
TEXTURE2D(_AlphaTex); SAMPLER(sampler_AlphaTex);
|
|
float _EnableAlphaTexture;
|
|
#endif
|
|
float4 _RendererColor;
|
|
|
|
${Graph}
|
|
struct GraphVertexOutput
|
|
{
|
|
float4 position : POSITION;
|
|
${VertexOutputStruct}
|
|
};
|
|
|
|
GraphVertexOutput vert (GraphVertexInput v)
|
|
{
|
|
GraphVertexOutput o = (GraphVertexOutput)0;
|
|
${VertexShader}
|
|
VertexDescriptionInputs vdi = (VertexDescriptionInputs)0;
|
|
${VertexShaderDescriptionInputs}
|
|
VertexDescription vd = PopulateVertexData(vdi);
|
|
|
|
v.vertex.xyz = vd.Position;
|
|
VertexColor = v.color;
|
|
o.position = TransformObjectToHClip(v.vertex.xyz);
|
|
|
|
${VertexShaderOutputs}
|
|
return o;
|
|
}
|
|
|
|
half4 frag (GraphVertexOutput IN) : SV_Target
|
|
{
|
|
${PixelShader}
|
|
SurfaceDescriptionInputs surfaceInput = (SurfaceDescriptionInputs)0;
|
|
${PixelShaderSurfaceInputs}
|
|
SurfaceDescription surf = PopulateSurfaceData(surfaceInput);
|
|
|
|
#if ETC1_EXTERNAL_ALPHA
|
|
float4 alpha = SAMPLE_TEXTURE2D(_AlphaTex, sampler_AlphaTex, IN.uv0.xy);
|
|
surf.Color.a = lerp (surf.Color.a, alpha.r, _EnableAlphaTexture);
|
|
#endif
|
|
|
|
surf.Color *= IN.VertexColor;
|
|
return surf.Color;
|
|
}
|
|
|
|
ENDHLSL
|
|
}
|