fix(heatmap): 低温段改为蓝色噪点并保留发热色带
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -22,8 +22,8 @@ public class HeatMapController : MonoBehaviour
|
||||
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] private Color coldBaseColor = new Color(0.005f, 0.02f, 0.55f, 1f);
|
||||
[SerializeField] private Color coldHighlightColor = new Color(0f, 0.3f, 1f, 1f);
|
||||
[SerializeField, Min(0.01f)] private float coldNoiseScale = 1.8f;
|
||||
[SerializeField, Range(0f, 1f)] private float coldNoiseStrength = 0.45f;
|
||||
public Vector3 inPos; // Heatmap进入位置
|
||||
@@ -244,7 +244,7 @@ public class HeatMapController : MonoBehaviour
|
||||
public void SetDataToMaterial()
|
||||
{
|
||||
// 逻辑温度 0~2 → shader 侧发热强度;各段端点连续,避免跨档跳变。
|
||||
// t=0 冷态压低,接近「看不见」;t=1/2 保持原有发热观感。
|
||||
// 保持原有温度映射,冷色替换只由 shader 处理。
|
||||
if (tempture <= 1f)
|
||||
{
|
||||
float t = Mathf.Clamp01(tempture);
|
||||
@@ -256,7 +256,7 @@ public class HeatMapController : MonoBehaviour
|
||||
{
|
||||
float t = Mathf.Clamp01(tempture - 1f);
|
||||
uftempture = Mathf.Lerp(2.8f, 3.2f, t);
|
||||
modulesTempture = Mathf.Lerp(1.6f, 2.3f, t); // 原 1.8 起点与上一段不连续
|
||||
modulesTempture = Mathf.Lerp(1.6f, 2.3f, t);
|
||||
backtemture = Mathf.Lerp(2.25f, 3.4f, t);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ Shader "Unlit/HeatTest"
|
||||
_Speaktexture ("_Speaktexture", 2D) = "white" {}
|
||||
_headtexture ("_headtexture", 2D) = "white" {}
|
||||
_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)
|
||||
_ColdBaseColor ("Cold Base Color", Color) = (0.005, 0.02, 0.55, 1)
|
||||
_ColdHighlightColor ("Cold Highlight Color", Color) = (0, 0.3, 1, 1)
|
||||
_ColdNoiseScale ("Cold Noise Scale", Float) = 1.8
|
||||
_ColdNoiseStrength ("Cold Noise Strength", Range(0, 1)) = 0.45
|
||||
}
|
||||
@@ -150,7 +150,8 @@ fixed4 frag (v2f i) : SV_Target
|
||||
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);
|
||||
fixed4 coldColor = lerp(_ColdBaseColor, _ColdHighlightColor, coldVariation);
|
||||
fixed4 col = coldColor;
|
||||
bool isFind = false;
|
||||
|
||||
|
||||
@@ -184,7 +185,10 @@ fixed4 frag (v2f i) : SV_Target
|
||||
|
||||
|
||||
fixed4 rampColor = tex2D(_RampTexture, float2(alpha, 0));
|
||||
col = rampColor;
|
||||
// 保留原有色带映射,只把接近黑色的冷端替换为蓝色。
|
||||
float brightestChannel = max(rampColor.r, max(rampColor.g, rampColor.b));
|
||||
float blackMask = 1.0 - smoothstep(0.035, 0.12, brightestChannel);
|
||||
col = lerp(rampColor, coldColor, blackMask);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +210,9 @@ fixed4 frag (v2f i) : SV_Target
|
||||
alpha=backalpha;
|
||||
|
||||
fixed4 rampColor = tex2D(_RampTexture, float2(alpha, 0));
|
||||
col = rampColor;
|
||||
float brightestChannel = max(rampColor.r, max(rampColor.g, rampColor.b));
|
||||
float blackMask = 1.0 - smoothstep(0.035, 0.12, brightestChannel);
|
||||
col = lerp(rampColor, coldColor, blackMask);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,8 @@ Material:
|
||||
m_Floats:
|
||||
- _Alpha: 0.992
|
||||
- _Boolean: 0
|
||||
- _ColdNoiseScale: 1.8
|
||||
- _ColdNoiseStrength: 0.45
|
||||
- _ColorHSV_Brightness_1: 1
|
||||
- _ColorHSV_Hue_1: 104
|
||||
- _ColorHSV_Saturation_1: 1
|
||||
@@ -158,6 +160,8 @@ Material:
|
||||
- _Center: {r: -3.77, g: 0.91, b: 0, a: 0}
|
||||
- _CenterScale: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _CircleModuleSize: {r: 1, g: 1, b: 0, a: 0}
|
||||
- _ColdBaseColor: {r: 0.005, g: 0.02, b: 0.55, a: 1}
|
||||
- _ColdHighlightColor: {r: 0, g: 0.3, b: 1, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ColorX: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Flip: {r: 1, g: 1, b: 1, a: 1}
|
||||
|
||||
Reference in New Issue
Block a user