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

78 lines
2.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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
}
}
}