simplify shaderr

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

No files matched your search

@@ -29,17 +29,17 @@ Material:
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _CoronaIntensity: 3
- _CoronaSize: 0.15
- _EdgeSoftness: 0.08
- _GlowIntensity: 3.12
- _Scale: 8.36
- _Speed: 0.21
- _SpotScale: 6.02
- _CoronaIntensity: 2.97
- _CoronaSize: 0.117
- _EdgeSoftness: 0.01
- _GlowIntensity: 2.8
- _Scale: 9.8
- _Speed: 1.21
- _SpotScale: 1
- _SpotThreshold: 0.187
- _Turbulence: 1.402
m_Colors:
- _BaseColor: {r: 0.5320757, g: 0.054250862, b: 0, a: 1}
- _HotColor: {r: 0.011320889, g: 0.010053102, b: 0.0005446946, a: 1}
- _SpotColor: {r: 0.15849048, g: 0.045304425, b: 0.045304425, a: 1}
- _BaseColor: {r: 1, g: 0.1, b: 0, a: 1}
- _HotColor: {r: 0.011764706, g: 0.011764706, b: 0, a: 1}
- _SpotColor: {r: 0.3, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4d87b62cb3f1287bdbd0c96890935e5c
guid: 087cc6e8f0f8dd18eade29197bcae347
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
@@ -29,13 +29,13 @@ Material:
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _CoronaIntensity: 3
- _CoronaSize: 0.15
- _EdgeSoftness: 0.08
- _CoronaIntensity: 2.97
- _CoronaSize: 0.117
- _EdgeSoftness: 0.01
- _GlowIntensity: 3.12
- _Scale: 8.36
- _Scale: 6.1
- _Speed: 0.21
- _SpotScale: 6.02
- _SpotScale: 1
- _SpotThreshold: 0.187
- _Turbulence: 1.402
m_Colors:
@@ -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);