This commit is contained in:
Thewildcard-pt 2020-03-25 12:16:54 +00:00
commit c8762dfae9
13 changed files with 216 additions and 173 deletions

View file

@ -57,14 +57,18 @@ Material:
m_Offset: {x: 0, y: 0}
m_Floats:
- Distortion: 0.5
- Gain: 0.1
- Gather: -1
- GatherWavelength: 2
- NoiseAmplitude: 0.5
- NoiseFrequency: 0.3
- NoiseGain: 0.6
- NoiseLacunarity: 2.5
- NoiseOffset: 0.35
- NoiseFrequency: 0.2
- NoiseGain: 0.66
- NoiseLacunarity: 2.25
- NoiseOffset: 0.5
- NoisePosition: 0
- Parallax: -0.2
- ScrollSpeed: 2
- Parallax: -0.1
- ParallaxLacunarity: 2
- ScrollSpeed: 1
- Speed: 5
- _BumpScale: 1
- _Cutoff: 0.5
@ -86,7 +90,7 @@ Material:
m_Colors:
- ParallaxDirection: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color1: {r: 0, g: 0.12804878, b: 0.25, a: 1}
- _Color2: {r: 0.15, g: 0, b: 0.0077922107, a: 1}
- _Color3: {r: 0, g: 0.05, b: 0.028846158, a: 1}
- _Color1: {r: 0, g: 0.2587719, b: 0.5, a: 1}
- _Color2: {r: 0.252, g: 0.057832334, b: 0.0141119985, a: 1}
- _Color3: {r: 0.008918005, g: 0.091000006, b: 0.053115997, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View file

@ -60,6 +60,7 @@ Material:
- _AngleWidth: 0.0001
- _BumpScale: 1
- _Cutoff: 0.5
- _DangerSteepness: 2
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
@ -79,6 +80,7 @@ Material:
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _AngleColor: {r: 0.029527554, g: 0.15, b: 0.10984253, a: 1}
- _AngleColor: {r: 0, g: 0, b: 0, a: 1}
- _Color: {r: 0.071093746, g: 0.16406254, b: 0.35, a: 1}
- _DangerColor: {r: 1, g: 0.3473333, b: 0.020999968, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f76d0e937a209ee42b3e807299a9e7cf
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -14,9 +14,12 @@
Speed("Speed", Float) = 1
ScrollSpeed("ScrollSpeed", Float) = 1
Distortion("Distortion", Float) = 1
ParallaxLacunarity("ParallaxLacunarity", Float) = 2
ParallaxDirection("ParallaxDirection", Vector) = (0,0,0,0)
Parallax("Parallax", Float) = 1
Gather("Gather", Float) = 1
Gain("Gain", Float) = 1
GatherWavelength("GatherWavelength", Float) = 1
}
SubShader
{
@ -59,8 +62,12 @@
float Speed;
float ScrollSpeed;
float Distortion;
float ParallaxLacunarity;
float2 ParallaxDirection;
float Parallax;
float Gather;
float GatherWavelength;
float Gain;
v2f vert (appdata v)
{
@ -76,10 +83,10 @@
float freq = NoiseFrequency, amp = .5;
float parallax = Parallax;
float sum = 0;
for(int i = 0; i < 4; i++)
for(int i = 0; i < 6; i++)
{
sum += snoise(p * freq + Parallax * ParallaxDirection) * amp;
parallax /= NoiseLacunarity;
parallax /= ParallaxLacunarity;
freq *= NoiseLacunarity;
amp *= NoiseGain;
}
@ -92,10 +99,10 @@
float freq = NoiseFrequency, amp = .5;
float parallax = Parallax;
float2 sum = 0;
for(int i = 0; i < 4; i++)
for(int i = 0; i < 5; i++)
{
sum += snoise_grad(p * freq + Parallax * ParallaxDirection) * amp;
parallax /= NoiseLacunarity;
parallax /= ParallaxLacunarity;
freq *= NoiseLacunarity;
amp *= NoiseGain;
}
@ -118,7 +125,8 @@
float2 offset2 = mul(float3(fbmgrad(offsetuv1),1), rot2).xy;
float2 offsetuv2 = i.uv + offset2 * Distortion * .5 + float2(0,_Time.x*ScrollSpeed*.5);
float noise2 = abs(fbm(offsetuv1));
return float4(noise1*_Color1.rgb+abs(noise0-noise1)*_Color2.rgb + abs(noise0-noise2) * _Color3.rgb, 1);
float gather = pow(.5+snoise(offset1 * (NoiseFrequency / GatherWavelength))/2, Gather);
return float4((noise1*_Color1.rgb+abs(noise0-noise1)*_Color2.rgb + abs(noise0-noise2) * _Color3.rgb) * gather * Gain, 1);
}
ENDCG
}

View file

@ -5,12 +5,14 @@
_MainTex ("Texture", 2D) = "white" {}
_Color ("Color", Color) = (.5,.5,.5,1)
_AngleColor ("Angle Color", Color) = (.5,.5,.5,1)
_DangerColor ("Danger Color", Color) = (.5,.5,.5,1)
_StartHeight("Start Height", Float) = 0
_HeightRange("Height Range", Float) = 100
_LineWidth("Line Width", Float) = .1
_LineFade("Line Fade", Float) = .1
_AngleWidth("Angle Width", Float) = .1
_AngleFade("Angle Fade", Float) = .1
_DangerSteepness("Danger Steepness", Float) = .1
}
SubShader
{
@ -46,12 +48,14 @@
float4 _MainTex_TexelSize;
float4 _Color;
float4 _AngleColor;
float4 _DangerColor;
float _StartHeight;
float _HeightRange;
float _LineWidth;
float _LineFade;
float _AngleWidth;
float _AngleFade;
float _DangerSteepness;
v2f vert (appdata v)
{
@ -80,13 +84,15 @@
float planmag = length(plan);
float dangerblend = smoothstep(0,_DangerSteepness,planmag);
// Loop over isolines, computing a pseudo distance field for a number of height values
float spacing = _HeightRange / 20;
for (int i = 0; i < 20; i++) {
float isoline = abs(h - _StartHeight + (i*spacing));
//float2 isograd = float2(ddx(isoline), ddy(isoline));
//float isomag = length(isograd);
col += (1-smoothstep(_LineWidth * _ScreenParams.y, _LineWidth * _ScreenParams.y * _LineFade, isoline / planmag)) * _Color * blend; // Isoline
col += (1-smoothstep(_LineWidth * _ScreenParams.y, _LineWidth * _ScreenParams.y * _LineFade, isoline / planmag)) * lerp(_Color,_DangerColor,dangerblend) * blend; // Isoline
}
float angle = atan2(plan.y,plan.x) / 3.1415926536 + 1;
@ -104,7 +110,7 @@
float isoline = abs(angle - i / 6.0);// ;
//float2 isograd = float2(ddx_fine(isoline), ddy_fine(isoline));
//float isomag = min(length(isograd),0.025); // isomag is huge over atan2 boundary so clamp it to avoid false positives
col += (1-smoothstep(_AngleWidth * _ScreenParams.y, _AngleWidth * _ScreenParams.y * _AngleFade, isoline / (angmag))) * _AngleColor * blend; // Isoline
col += (1-smoothstep(_AngleWidth * _ScreenParams.y, _AngleWidth * _ScreenParams.y * _AngleFade, isoline / (angmag))) * lerp(_AngleColor,_DangerColor,dangerblend) * blend; // Isoline
}
//return float4(1,0,0,1);