NLDClient-yudde/ProjectNLD/Assets/Code/Shaders/Scene/NLD_Scene_Surface.shader

78 lines
2.1 KiB
Plaintext
Raw Normal View History

2023-12-12 20:03:44 +08:00
Shader "NLD_URP/NLD_Scene_Surface"
{
//目前效果还有问题可能需要新加pass写入深度一次
Properties
{
[Header(Main map)]
_MainTex ("MainTex", 2D) = "white" {}
_Color("Base Tint", color) = (1,1,1,1)
}
SubShader
{
Tags
{
"RenderType" = "Transparent" "RenderPipeline" = "UniversalPipeline" "IgnoreProjector" = "True" "Queue" = "Transparent"
}
pass
{
name "Base"
Tags
{
"LightMode" = "UniversalForward"
}
Cull Back
ZWrite Off
ZTest On
Blend SrcAlpha OneMinusSrcAlpha
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_instancing
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
TEXTURE2D(_MainTex);
SAMPLER(sampler_MainTex);
half4 _MainTex_ST;
half4 _Color;
half _ShadowIntensity;
half _AmbientMultiplier;
struct Attributes
{
float3 positionOS : POSITION;
float4 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
float2 uv : TEXCOORD0;
float4 positionCS : SV_POSITION;
};
Varyings vert(Attributes input)
{
Varyings output;
UNITY_SETUP_INSTANCE_ID(input);
output.uv = input.texcoord;
output.positionCS = TransformObjectToHClip(input.positionOS);
return output;
}
float4 frag(Varyings input) : SV_Target
{
half4 baseColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv);
half4 finalColor = baseColor * _Color;
return finalColor;
}
ENDHLSL
}
}
}