修改场景物品的shader,改为接受光照
This commit is contained in:
@@ -35,6 +35,7 @@ Shader "Custom/SpriteWithGroundClip"
|
||||
Pass
|
||||
{
|
||||
Name "SpriteWithGroundClip"
|
||||
Tags { "LightMode" = "UniversalForward" }
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
@@ -42,6 +43,7 @@ Shader "Custom/SpriteWithGroundClip"
|
||||
#pragma multi_compile_instancing
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
@@ -92,6 +94,10 @@ Shader "Custom/SpriteWithGroundClip"
|
||||
half4 texColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv);
|
||||
half4 color = texColor * input.color * _Color;
|
||||
|
||||
// 直接接受 Directional Light 的颜色和强度(color 已包含 intensity)
|
||||
Light mainLight = GetMainLight();
|
||||
color.rgb *= mainLight.color;
|
||||
|
||||
// 地面裁剪逻辑
|
||||
if (_EnableClip > 0.5)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user