From a6750a08b3037a5e892c812bc464db64c916503a Mon Sep 17 00:00:00 2001 From: Nathan Rashleigh Date: Fri, 27 Mar 2026 18:05:30 +1100 Subject: [PATCH] simplify shaderr --- .../Materials/Skybox Shaders/LiquidStar 1.mat | 20 ++++---- .../Skybox Shaders/LiquidStar 1.mat.meta | 2 +- .../Materials/Skybox Shaders/LiquidStar.mat | 10 ++-- .../Skybox Shaders/LiquidStar.shader | 51 +++++++------------ Assets/Scenes/sr_alpha_centaurus.unity | 2 +- 5 files changed, 34 insertions(+), 51 deletions(-) diff --git a/Assets/Materials/Skybox Shaders/LiquidStar 1.mat b/Assets/Materials/Skybox Shaders/LiquidStar 1.mat index 4c5afab..e4d5dfe 100644 --- a/Assets/Materials/Skybox Shaders/LiquidStar 1.mat +++ b/Assets/Materials/Skybox Shaders/LiquidStar 1.mat @@ -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: [] diff --git a/Assets/Materials/Skybox Shaders/LiquidStar 1.mat.meta b/Assets/Materials/Skybox Shaders/LiquidStar 1.mat.meta index a17b95c..2237ecb 100644 --- a/Assets/Materials/Skybox Shaders/LiquidStar 1.mat.meta +++ b/Assets/Materials/Skybox Shaders/LiquidStar 1.mat.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4d87b62cb3f1287bdbd0c96890935e5c +guid: 087cc6e8f0f8dd18eade29197bcae347 NativeFormatImporter: externalObjects: {} mainObjectFileID: 2100000 diff --git a/Assets/Materials/Skybox Shaders/LiquidStar.mat b/Assets/Materials/Skybox Shaders/LiquidStar.mat index 0cc853f..09c1516 100644 --- a/Assets/Materials/Skybox Shaders/LiquidStar.mat +++ b/Assets/Materials/Skybox Shaders/LiquidStar.mat @@ -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: diff --git a/Assets/Materials/Skybox Shaders/LiquidStar.shader b/Assets/Materials/Skybox Shaders/LiquidStar.shader index ce3bd31..a9e08a1 100644 --- a/Assets/Materials/Skybox Shaders/LiquidStar.shader +++ b/Assets/Materials/Skybox Shaders/LiquidStar.shader @@ -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); diff --git a/Assets/Scenes/sr_alpha_centaurus.unity b/Assets/Scenes/sr_alpha_centaurus.unity index 842aa17..2c048c5 100644 --- a/Assets/Scenes/sr_alpha_centaurus.unity +++ b/Assets/Scenes/sr_alpha_centaurus.unity @@ -1187,7 +1187,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 55586690bd6b4a6ca0646858c09cdd6e, type: 2} + - {fileID: 2100000, guid: 087cc6e8f0f8dd18eade29197bcae347, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0