liquid star
This commit is contained in:
1 parent
a9b3545ee0
commit
e442a86cfc
20 files changed
+1051
-20
No files matched your search
@@ -0,0 +1,45 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: LiquidStar 1
|
||||
m_Shader: {fileID: 4800000, guid: 39b526c240f342f98df3892438221ab4, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
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
|
||||
- _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}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d87b62cb3f1287bdbd0c96890935e5c
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,45 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: LiquidStar
|
||||
m_Shader: {fileID: 4800000, guid: 39b526c240f342f98df3892438221ab4, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
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
|
||||
- _SpotThreshold: 0.187
|
||||
- _Turbulence: 1.402
|
||||
m_Colors:
|
||||
- _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: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55586690bd6b4a6ca0646858c09cdd6e
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,233 @@
|
||||
Shader "Unlit/LiquidStar"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Speed("Flow Speed", Range(0.01, 5.0)) = 0.8
|
||||
_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
|
||||
_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
|
||||
_CoronaSize("Corona Size", Range(0.0, 0.4)) = 0.15
|
||||
_CoronaIntensity("Corona Intensity", Range(0.0, 10.0)) = 3.0
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" "Queue"="Geometry" }
|
||||
LOD 100
|
||||
ZWrite On
|
||||
Cull Off
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
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;
|
||||
float _Scale;
|
||||
float4 _BaseColor;
|
||||
float4 _HotColor;
|
||||
float4 _SpotColor;
|
||||
float _SpotScale;
|
||||
float _SpotThreshold;
|
||||
float _GlowIntensity;
|
||||
float _Turbulence;
|
||||
float _EdgeSoftness;
|
||||
float _CoronaSize;
|
||||
float _CoronaIntensity;
|
||||
|
||||
// 3D simplex-style noise
|
||||
float3 mod289(float3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
||||
float4 mod289(float4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
||||
float4 permute(float4 x) { return mod289(((x * 34.0) + 10.0) * x); }
|
||||
float4 taylorInvSqrt(float4 r) { return 1.79284291400159 - 0.85373472095314 * r; }
|
||||
|
||||
float snoise(float3 v)
|
||||
{
|
||||
const float2 C = float2(1.0 / 6.0, 1.0 / 3.0);
|
||||
const float4 D = float4(0.0, 0.5, 1.0, 2.0);
|
||||
|
||||
float3 i = floor(v + dot(v, C.yyy));
|
||||
float3 x0 = v - i + dot(i, C.xxx);
|
||||
|
||||
float3 g = step(x0.yzx, x0.xyz);
|
||||
float3 l = 1.0 - g;
|
||||
float3 i1 = min(g.xyz, l.zxy);
|
||||
float3 i2 = max(g.xyz, l.zxy);
|
||||
|
||||
float3 x1 = x0 - i1 + C.xxx;
|
||||
float3 x2 = x0 - i2 + C.yyy;
|
||||
float3 x3 = x0 - D.yyy;
|
||||
|
||||
i = mod289(i);
|
||||
float4 p = permute(permute(permute(
|
||||
i.z + float4(0.0, i1.z, i2.z, 1.0))
|
||||
+ i.y + float4(0.0, i1.y, i2.y, 1.0))
|
||||
+ i.x + float4(0.0, i1.x, i2.x, 1.0));
|
||||
|
||||
float n_ = 0.142857142857;
|
||||
float3 ns = n_ * D.wyz - D.xzx;
|
||||
|
||||
float4 j = p - 49.0 * floor(p * ns.z * ns.z);
|
||||
|
||||
float4 x_ = floor(j * ns.z);
|
||||
float4 y_ = floor(j - 7.0 * x_);
|
||||
|
||||
float4 x = x_ * ns.x + ns.yyyy;
|
||||
float4 y = y_ * ns.x + ns.yyyy;
|
||||
float4 h = 1.0 - abs(x) - abs(y);
|
||||
|
||||
float4 b0 = float4(x.xy, y.xy);
|
||||
float4 b1 = float4(x.zw, y.zw);
|
||||
|
||||
float4 s0 = floor(b0) * 2.0 + 1.0;
|
||||
float4 s1 = floor(b1) * 2.0 + 1.0;
|
||||
float4 sh = -step(h, float4(0, 0, 0, 0));
|
||||
|
||||
float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;
|
||||
float4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
|
||||
|
||||
float3 p0 = float3(a0.xy, h.x);
|
||||
float3 p1 = float3(a0.zw, h.y);
|
||||
float3 p2 = float3(a1.xy, h.z);
|
||||
float3 p3 = float3(a1.zw, h.w);
|
||||
|
||||
float4 norm = taylorInvSqrt(float4(dot(p0,p0), dot(p1,p1), dot(p2,p2), dot(p3,p3)));
|
||||
p0 *= norm.x;
|
||||
p1 *= norm.y;
|
||||
p2 *= norm.z;
|
||||
p3 *= norm.w;
|
||||
|
||||
float4 m = max(0.6 - float4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
|
||||
m = m * m;
|
||||
return 42.0 * dot(m * m, float4(dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3)));
|
||||
}
|
||||
|
||||
// Fractal brownian motion
|
||||
float fbm(float3 p, int octaves)
|
||||
{
|
||||
float value = 0.0;
|
||||
float amplitude = 0.5;
|
||||
float frequency = 1.0;
|
||||
for (int i = 0; i < octaves; i++)
|
||||
{
|
||||
value += amplitude * snoise(p * frequency);
|
||||
amplitude *= 0.5;
|
||||
frequency *= 2.0;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
float4 frag(v2f i) : SV_Target
|
||||
{
|
||||
// Remap UV to centered [-1, 1] range
|
||||
float2 centeredUV = i.uv * 2.0 - 1.0;
|
||||
|
||||
// Shrink the star so disk + corona fits inside the quad
|
||||
float starRadius = 1.0 / (1.0 + _CoronaSize);
|
||||
float dist = length(centeredUV) / starRadius;
|
||||
|
||||
// Discard outside the circle + corona
|
||||
if (dist > 1.0 + _CoronaSize) discard;
|
||||
|
||||
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);
|
||||
|
||||
// Liquid flow - domain warping (4 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)
|
||||
);
|
||||
|
||||
// Inner layers - low octaves for smooth fills
|
||||
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)
|
||||
);
|
||||
|
||||
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);
|
||||
|
||||
// Convection cells - granulation pattern
|
||||
float granulation = snoise(float3(centeredUV * _Scale * 3.0, time * 0.4));
|
||||
granulation = granulation * 0.5 + 0.5;
|
||||
|
||||
// Blend colors
|
||||
float heatMap = liquidPattern * 0.5 + 0.5;
|
||||
heatMap = saturate(heatMap + granulation * 0.2);
|
||||
|
||||
// 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);
|
||||
|
||||
// Limb darkening - darken edges of the star disk
|
||||
float limbDarken = 1.0 - pow(dist, 2.0);
|
||||
col *= max(limbDarken, 0.3);
|
||||
|
||||
// HDR glow intensity
|
||||
col *= _GlowIntensity;
|
||||
|
||||
// Outside the star disk: corona fading to black
|
||||
if (dist > 1.0)
|
||||
{
|
||||
float coronaDist = (dist - 1.0) / _CoronaSize;
|
||||
float coronaFade = (1.0 - coronaDist) * (1.0 - coronaDist);
|
||||
col = lerp(_BaseColor.rgb, _HotColor.rgb, 0.7) * _CoronaIntensity * coronaFade;
|
||||
}
|
||||
else if (dist > 1.0 - _EdgeSoftness)
|
||||
{
|
||||
// Soft edge of star disk
|
||||
float edgeFade = smoothstep(1.0, 1.0 - _EdgeSoftness, dist);
|
||||
col = lerp(float3(0, 0, 0), col, edgeFade);
|
||||
}
|
||||
|
||||
return float4(col, 1.0);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39b526c240f342f98df3892438221ab4
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: SolarFlare
|
||||
m_Shader: {fileID: 4800000, guid: e44218cd855f4eada13a6505c3c577f2, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 1
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _FadeEdge: 2
|
||||
- _FadeEnds: 0.15
|
||||
- _FlowDir: 1
|
||||
- _Intensity: 2
|
||||
- _Scale: 3
|
||||
- _Speed: 0.2
|
||||
- _Wisps: 4
|
||||
m_Colors:
|
||||
- _FlareColor: {r: 1, g: 0.2, b: 0.05, a: 1}
|
||||
- _HotColor: {r: 1, g: 0.8, b: 0.3, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 08c186d972d6480287ccbdf019a7ad51
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,177 @@
|
||||
Shader "Unlit/SolarFlare"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Speed("Flow Speed", Range(0.01, 5.0)) = 1.0
|
||||
_Scale("Pattern Scale", Range(0.5, 20.0)) = 3.0
|
||||
_FlareColor("Flare Color", Color) = (1.0, 0.3, 0.05, 1.0)
|
||||
_HotColor("Hot Color", Color) = (1.0, 0.8, 0.3, 1.0)
|
||||
_Intensity("Intensity", Range(0.1, 10.0)) = 3.0
|
||||
_FlowDir("Flow Direction", Range(-1, 1)) = 1.0
|
||||
_FadeEdge("Edge Fade Power", Range(0.5, 5.0)) = 2.0
|
||||
_FadeEnds("End Fade", Range(0.0, 0.5)) = 0.15
|
||||
_Wisps("Wisp Count", Range(1.0, 8.0)) = 4.0
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
|
||||
LOD 100
|
||||
Blend One One
|
||||
ZWrite Off
|
||||
Cull Off
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
};
|
||||
|
||||
float _Speed;
|
||||
float _Scale;
|
||||
float4 _FlareColor;
|
||||
float4 _HotColor;
|
||||
float _Intensity;
|
||||
float _FlowDir;
|
||||
float _FadeEdge;
|
||||
float _FadeEnds;
|
||||
float _Wisps;
|
||||
|
||||
// 3D simplex noise (same as LiquidStar)
|
||||
float3 mod289(float3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
||||
float4 mod289(float4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
||||
float4 permute(float4 x) { return mod289(((x * 34.0) + 10.0) * x); }
|
||||
float4 taylorInvSqrt(float4 r) { return 1.79284291400159 - 0.85373472095314 * r; }
|
||||
|
||||
float snoise(float3 v)
|
||||
{
|
||||
const float2 C = float2(1.0 / 6.0, 1.0 / 3.0);
|
||||
const float4 D = float4(0.0, 0.5, 1.0, 2.0);
|
||||
|
||||
float3 i = floor(v + dot(v, C.yyy));
|
||||
float3 x0 = v - i + dot(i, C.xxx);
|
||||
|
||||
float3 g = step(x0.yzx, x0.xyz);
|
||||
float3 l = 1.0 - g;
|
||||
float3 i1 = min(g.xyz, l.zxy);
|
||||
float3 i2 = max(g.xyz, l.zxy);
|
||||
|
||||
float3 x1 = x0 - i1 + C.xxx;
|
||||
float3 x2 = x0 - i2 + C.yyy;
|
||||
float3 x3 = x0 - D.yyy;
|
||||
|
||||
i = mod289(i);
|
||||
float4 p = permute(permute(permute(
|
||||
i.z + float4(0.0, i1.z, i2.z, 1.0))
|
||||
+ i.y + float4(0.0, i1.y, i2.y, 1.0))
|
||||
+ i.x + float4(0.0, i1.x, i2.x, 1.0));
|
||||
|
||||
float n_ = 0.142857142857;
|
||||
float3 ns = n_ * D.wyz - D.xzx;
|
||||
|
||||
float4 j = p - 49.0 * floor(p * ns.z * ns.z);
|
||||
|
||||
float4 x_ = floor(j * ns.z);
|
||||
float4 y_ = floor(j - 7.0 * x_);
|
||||
|
||||
float4 x = x_ * ns.x + ns.yyyy;
|
||||
float4 y = y_ * ns.x + ns.yyyy;
|
||||
float4 h = 1.0 - abs(x) - abs(y);
|
||||
|
||||
float4 b0 = float4(x.xy, y.xy);
|
||||
float4 b1 = float4(x.zw, y.zw);
|
||||
|
||||
float4 s0 = floor(b0) * 2.0 + 1.0;
|
||||
float4 s1 = floor(b1) * 2.0 + 1.0;
|
||||
float4 sh = -step(h, float4(0, 0, 0, 0));
|
||||
|
||||
float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;
|
||||
float4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
|
||||
|
||||
float3 p0 = float3(a0.xy, h.x);
|
||||
float3 p1 = float3(a0.zw, h.y);
|
||||
float3 p2 = float3(a1.xy, h.z);
|
||||
float3 p3 = float3(a1.zw, h.w);
|
||||
|
||||
float4 norm = taylorInvSqrt(float4(dot(p0,p0), dot(p1,p1), dot(p2,p2), dot(p3,p3)));
|
||||
p0 *= norm.x;
|
||||
p1 *= norm.y;
|
||||
p2 *= norm.z;
|
||||
p3 *= norm.w;
|
||||
|
||||
float4 m = max(0.6 - float4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
|
||||
m = m * m;
|
||||
return 42.0 * dot(m * m, float4(dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3)));
|
||||
}
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag(v2f i) : SV_Target
|
||||
{
|
||||
float time = _Time.y * _Speed;
|
||||
|
||||
// UV: x wraps around cylinder, y goes along length
|
||||
float2 uv = i.uv;
|
||||
|
||||
// Flow along the cylinder length
|
||||
float flow = uv.y + time * _FlowDir * 0.2;
|
||||
|
||||
// Wispy tendrils flowing along the cylinder
|
||||
float3 p = float3(uv.x * _Scale, flow * _Scale, time * 0.1);
|
||||
|
||||
float n1 = snoise(p); // 1
|
||||
float n2 = snoise(p * 1.7 + float3(5.2, time * 0.15, 1.3)); // 2
|
||||
float n3 = snoise(p * 0.5 + float3(time * 0.1, 3.1, 7.4)); // 3
|
||||
|
||||
// Wisp pattern - creates streaky tendrils
|
||||
float wispAngle = uv.x * _Wisps * 6.2831;
|
||||
float wisp = sin(wispAngle + n1 * 3.0 + flow * 4.0) * 0.5 + 0.5;
|
||||
wisp = pow(wisp, 3.0);
|
||||
|
||||
// Combine noise layers
|
||||
float pattern = wisp * (n2 * 0.5 + 0.5);
|
||||
pattern += pow(max(0, n3 * 0.5 + 0.5), 2.0) * 0.3;
|
||||
|
||||
// Pulsing hotspots that travel along the cylinder
|
||||
float pulse = snoise(float3(uv.x * 2.0, flow * 2.0, time * 0.3)); // 4
|
||||
float hotspot = pow(saturate(pulse), 4.0);
|
||||
|
||||
// Radial fade - fade out at edges of cylinder (using X as wrap-around)
|
||||
float radialDist = abs(uv.x - 0.5) * 2.0;
|
||||
float radialFade = pow(1.0 - saturate(radialDist), _FadeEdge);
|
||||
|
||||
// End caps fade - fade near top and bottom of cylinder
|
||||
float endFade = smoothstep(0.0, _FadeEnds, uv.y) * smoothstep(1.0, 1.0 - _FadeEnds, uv.y);
|
||||
|
||||
// Color
|
||||
float3 col = lerp(_FlareColor.rgb, _HotColor.rgb, hotspot + pattern * 0.3);
|
||||
col *= _Intensity;
|
||||
|
||||
float alpha = pattern * radialFade * endFade + hotspot * radialFade * endFade * 2.0;
|
||||
alpha = saturate(alpha);
|
||||
|
||||
return float4(col * alpha, 1.0);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e44218cd855f4eada13a6505c3c577f2
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user