shader
This commit is contained in:
parent
a7b1782755
commit
22bbc32fee
51
Assets/mat/SubShader.shader
Normal file
51
Assets/mat/SubShader.shader
Normal file
@ -0,0 +1,51 @@
|
||||
Shader "Custom/SubShader"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
_GlowColor ("Glow Color", Color) = (1, 1, 1, 1)
|
||||
_GlowPower ("Glow Power", Range(0, 10)) = 1
|
||||
_BlinkSpeed ("Blink Speed", Range(0.1, 10)) = 1
|
||||
_BlinkIntensity ("Blink Intensity", Range(0, 1)) = 0.5
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType" = "Opaque" "Queue" = "Geometry+1" }
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf Lambert
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _GlowColor;
|
||||
float _GlowPower;
|
||||
float _BlinkSpeed;
|
||||
float _BlinkIntensity;
|
||||
|
||||
struct Input
|
||||
{
|
||||
float2 uv_MainTex;
|
||||
};
|
||||
|
||||
void surf (Input IN, inout SurfaceOutput o)
|
||||
{
|
||||
half4 c = tex2D(_MainTex, IN.uv_MainTex);
|
||||
o.Albedo = c.rgb;
|
||||
o.Alpha = c.a;
|
||||
|
||||
// 获取时间变量,用于控制闪烁
|
||||
float time = _Time.y;
|
||||
|
||||
// 根据时间和闪烁速度计算闪烁因子
|
||||
float blinkFactor = sin(time * _BlinkSpeed);
|
||||
|
||||
// 根据闪烁因子和强度调整发光强度
|
||||
float adjustedGlowPower = _GlowPower * (1 + blinkFactor * _BlinkIntensity);
|
||||
|
||||
// 计算发光效果
|
||||
half3 glow = _GlowColor.rgb * adjustedGlowPower;
|
||||
o.Emission = glow;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
}
|
10
Assets/mat/SubShader.shader.meta
Normal file
10
Assets/mat/SubShader.shader.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93de9b44dfdccff48999928f1bcef462
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user