从旧版中移植,Prefab未确认
This commit is contained in:
58
Convention/[Art]/GridFull/Grid2D/Grid2D.shader
Normal file
58
Convention/[Art]/GridFull/Grid2D/Grid2D.shader
Normal file
@@ -0,0 +1,58 @@
|
||||
Shader "AD/uvTutorial"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags{
|
||||
"RenderPipeline"="UniversalRenderPipeline"
|
||||
"RenderType"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"Queue"="Transparent"
|
||||
}
|
||||
Pass
|
||||
{
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ZWrite off
|
||||
Cull off
|
||||
HLSLPROGRAM
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
struct Attributes{
|
||||
float4 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct Varings{
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
float _fragSize;
|
||||
float _frageCenter;
|
||||
|
||||
Varings vert(Attributes input){
|
||||
Varings o;
|
||||
o.positionCS = TransformObjectToHClip(input.positionOS);
|
||||
o.uv = input.uv;
|
||||
return o;
|
||||
}
|
||||
half4 frag(Varings input) : SV_TARGET{
|
||||
float2 uv = input.uv * 10;
|
||||
float2 derivative = fwidth(uv);
|
||||
uv = frac(uv);
|
||||
uv = abs(uv - 0.5);
|
||||
uv = uv / derivative; //<2F><><EFBFBD>↑ʼ<EFBFAA><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>dԽ<64><D4BD><EFBFBD><EFBFBD>uvԽС<D4BD><D0A1><EFBFBD><EFBFBD><EFBFBD>п<EFBFBD><D0BF><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD>alphaֵ<61><D6B5>
|
||||
float min_value = min(uv.x, uv.y);
|
||||
half alpha = 1.0 - min(min_value, 1.0); //ʵ<>ʵ<EFBFBD><CAB5>߿<EFBFBD><DFBF>ǿ<EFBFBD><C7BF><EFBFBD>x,y<><79><EFBFBD>ģ<EFBFBD>
|
||||
//Զ<><D4B6>x, y<><79><EFBFBD><EFBFBD>uvֵ<76><D6B5><EFBFBD><EFBFBD>min<69><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0
|
||||
return half4(1.0, 0.0, 0.0, alpha);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user