feat(fix-system): 优化低温热力图视觉表现
This commit is contained in:
@@ -21,6 +21,11 @@ public class HeatMapController : MonoBehaviour
|
||||
public RectTransform imageToMove; // 需要移动的Image
|
||||
public Transform imageToRotate; // 需要旋转的Image
|
||||
[SerializeField, Min(0f)] private float fanStopDuration = 0.15f;
|
||||
[Header("低温背景")]
|
||||
[SerializeField] private Color coldBaseColor = new Color(0.015f, 0.075f, 0.16f, 1f);
|
||||
[SerializeField] private Color coldHighlightColor = new Color(0.02f, 0.27f, 0.48f, 1f);
|
||||
[SerializeField, Min(0.01f)] private float coldNoiseScale = 1.8f;
|
||||
[SerializeField, Range(0f, 1f)] private float coldNoiseStrength = 0.45f;
|
||||
public Vector3 inPos; // Heatmap进入位置
|
||||
public Vector3 outPos; // Heatmap退出位置
|
||||
|
||||
@@ -295,6 +300,10 @@ public class HeatMapController : MonoBehaviour
|
||||
// 将数据传递给 Shader
|
||||
heatMaterial.SetVectorArray("_Points", points);
|
||||
heatMaterial.SetVectorArray("_Properties", properties);
|
||||
heatMaterial.SetColor("_ColdBaseColor", coldBaseColor);
|
||||
heatMaterial.SetColor("_ColdHighlightColor", coldHighlightColor);
|
||||
heatMaterial.SetFloat("_ColdNoiseScale", coldNoiseScale);
|
||||
heatMaterial.SetFloat("_ColdNoiseStrength", coldNoiseStrength);
|
||||
}
|
||||
|
||||
public void SetTemptureDirect(float value)
|
||||
|
||||
@@ -11,7 +11,11 @@ Shader "Unlit/HeatTest"
|
||||
_Logictexture ("_Logictexture", 2D) = "white" {}
|
||||
_Speaktexture ("_Speaktexture", 2D) = "white" {}
|
||||
_headtexture ("_headtexture", 2D) = "white" {}
|
||||
_Temtupre("_Temtupre", float) = 0 // 世界空间中的中心
|
||||
_Temtupre("_Temtupre", float) = 0 // 世界空间中的中心
|
||||
_ColdBaseColor ("Cold Base Color", Color) = (0.015, 0.075, 0.16, 1)
|
||||
_ColdHighlightColor ("Cold Highlight Color", Color) = (0.02, 0.27, 0.48, 1)
|
||||
_ColdNoiseScale ("Cold Noise Scale", Float) = 1.8
|
||||
_ColdNoiseStrength ("Cold Noise Strength", Range(0, 1)) = 0.45
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
@@ -56,6 +60,10 @@ Shader "Unlit/HeatTest"
|
||||
sampler2D _Speaktexture;
|
||||
sampler2D _headtexture;
|
||||
float _Temtupre;
|
||||
fixed4 _ColdBaseColor;
|
||||
fixed4 _ColdHighlightColor;
|
||||
float _ColdNoiseScale;
|
||||
float _ColdNoiseStrength;
|
||||
|
||||
inline float unity_noise_randomValue (float2 uv)
|
||||
{
|
||||
@@ -138,7 +146,11 @@ fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
|
||||
float3 worldPos = i.worldPos;
|
||||
fixed4 col = fixed4(0, 0, 0, 1); // Initial color
|
||||
// 热成像的无热源区域仍有环境温度,用细微流动的深蓝代替纯黑。
|
||||
float2 coldNoiseUV = worldPos.xy + float2(_Time.y * 0.012, -_Time.y * 0.009);
|
||||
float coldNoise = Unity_SimpleNoise(coldNoiseUV, _ColdNoiseScale);
|
||||
float coldVariation = saturate(0.18 + coldNoise * _ColdNoiseStrength);
|
||||
fixed4 col = lerp(_ColdBaseColor, _ColdHighlightColor, coldVariation);
|
||||
bool isFind = false;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user