simplify shaderr

This commit is contained in:
Nathan Rashleigh committed 2026-03-27 18:05:30 +11:00
1 parent b261f4d3d0
commit b2bb15b8fa
5 files changed
+34 -51

No files matched your search

@@ -6,9 +6,7 @@ Shader "Unlit/LiquidStar"
_Scale("Surface Scale", Range(0.5, 20.0)) = 3.0
_BaseColor("Base Color", Color) = (1.0, 0.1, 0.0, 1.0)
_HotColor("Hot Spot Color", Color) = (1.0, 0.9, 0.2, 1.0)
_SpotColor("Sunspot Color", Color) = (0.3, 0.0, 0.0, 1.0)
_SpotScale("Sunspot Scale", Range(1.0, 15.0)) = 5.0
_SpotThreshold("Sunspot Threshold", Range(0.0, 1.0)) = 0.45
_SpotColor("Dark Color", Color) = (0.3, 0.0, 0.0, 1.0)
_GlowIntensity("Glow Intensity", Range(1.0, 20.0)) = 6.0
_Turbulence("Turbulence", Range(0.0, 3.0)) = 1.2
_EdgeSoftness("Edge Softness", Range(0.01, 0.3)) = 0.08
@@ -34,15 +32,12 @@ Shader "Unlit/LiquidStar"
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float3 worldNormal : TEXCOORD1;
float3 worldPos : TEXCOORD2;
};
float _Speed;
@@ -50,8 +45,6 @@ Shader "Unlit/LiquidStar"
float4 _BaseColor;
float4 _HotColor;
float4 _SpotColor;
float _SpotScale;
float _SpotThreshold;
float _GlowIntensity;
float _Turbulence;
float _EdgeSoftness;
@@ -145,8 +138,6 @@ Shader "Unlit/LiquidStar"
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
o.worldNormal = UnityObjectToWorldNormal(v.normal);
o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
return o;
}
@@ -165,44 +156,36 @@ Shader "Unlit/LiquidStar"
float time = _Time.y * _Speed;
// Use UV-based 3D coordinate for noise (flat plane, no sphere artifacts)
float3 p = float3(centeredUV * _Scale, time * 0.1);
float3 p = float3(centeredUV * _Scale, time * 0.02);
// Liquid flow - domain warping (4 octaves for island edges)
// Liquid flow - domain warping (2 octaves for island edges)
float3 q = float3(
fbm(p + float3(0.0, 0.0, time * 0.3), 4),
fbm(p + float3(5.2, 1.3, time * 0.25), 4),
fbm(p + float3(1.7, 9.2, time * 0.35), 4)
fbm(p + float3(0.0, 0.0, time * 0.06), 2),
fbm(p + float3(5.2, 1.3, time * 0.05), 2),
fbm(p + float3(1.7, 9.2, time * 0.07), 2)
);
// Inner layers - low octaves for smooth fills
// Inner layer - single pass smooth fill
float3 r = float3(
fbm(p + _Turbulence * q + float3(1.7, 9.2, time * 0.15), 1),
fbm(p + _Turbulence * q + float3(8.3, 2.8, time * 0.2), 1),
fbm(p + _Turbulence * q + float3(3.1, 6.5, time * 0.1), 1)
snoise(p + _Turbulence * q + float3(1.7, 9.2, time * 0.03)),
snoise(p + _Turbulence * q + float3(8.3, 2.8, time * 0.04)),
snoise(p + _Turbulence * q + float3(3.1, 6.5, time * 0.02))
);
float liquidPattern = fbm(p + _Turbulence * r, 1);
// Sunspots - low frequency
float3 spotP = float3(centeredUV * _SpotScale, time * 0.05);
float spotNoise = fbm(spotP + float3(time * 0.05, time * 0.03, time * 0.07), 2);
// Darken areas where noise is below threshold = sunspots
float spotMask = smoothstep(_SpotThreshold - 0.15, _SpotThreshold, spotNoise);
float liquidPattern = snoise(p + _Turbulence * r);
// Convection cells - granulation pattern
float granulation = snoise(float3(centeredUV * _Scale * 3.0, time * 0.4));
float granulation = snoise(float3(centeredUV * _Scale * 3.0, time * 0.08));
granulation = granulation * 0.5 + 0.5;
// Blend colors
// Blend colors - use granulation heavily for contrast
float heatMap = liquidPattern * 0.5 + 0.5;
heatMap = saturate(heatMap + granulation * 0.2);
heatMap = saturate(heatMap * granulation);
heatMap = pow(heatMap, 0.7);
// Base liquid surface color
float3 col = lerp(_BaseColor.rgb, _HotColor.rgb, pow(heatMap, 1.5));
// Apply sunspots (dark cooler regions)
col = lerp(_SpotColor.rgb, col, spotMask);
float3 col = lerp(_SpotColor.rgb, _BaseColor.rgb, heatMap);
col = lerp(col, _HotColor.rgb, pow(heatMap, 2.5));
// Limb darkening - darken edges of the star disk
float limbDarken = 1.0 - pow(dist, 2.0);