Skip to content

Commit 07e0d48

Browse files
committed
improve look
1 parent 6a75155 commit 07e0d48

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

Assets/Demoscene/Projects/2018-07-12-Lava/Lava.mat

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ Material:
2323
m_Scale: {x: 1, y: 1}
2424
m_Offset: {x: 0, y: 0}
2525
m_Floats:
26-
- _CellularPower: 0.038
26+
- _CellularPower: 0.066
2727
- _FlowIntensity: 0.32
2828
- _FlowSpeed: 0.5
29-
- _FlowThreshold: 1.267
29+
- _FlowThreshold: 1.244
3030
- _Loop: 50
3131
- _MinDistance: 0.01
3232
- _ShadowExtraBias: 0.802
@@ -35,5 +35,6 @@ Material:
3535
m_Colors:
3636
- _Diffuse: {r: 0.9528302, g: 0.004494493, b: 0.004494493, a: 1}
3737
- _Emission: {r: 0, g: 0, b: 0, a: 0}
38-
- _LavaEmmisiveHigh: {r: 1, g: 0.24644177, b: 0, a: 1}
38+
- _LavaEmmisiveHigh: {r: 1, g: 0.46109614, b: 0.0141509175, a: 1}
39+
- _LavaEmmisiveLow: {r: 0.77254903, g: 0.2903899, b: 0, a: 1}
3940
- _Specular: {r: 0, g: 0, b: 0, a: 0}

Assets/Demoscene/Projects/2018-07-12-Lava/Lava.shader

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Properties
1818
// @block Properties
1919
_CellularPower("Cellular Power", Range(0.0, 1.0)) = 0.5
2020
[HDR] _LavaEmmisiveHigh("Lava Emmisive High", Color) = (1.0, 0.0, 0.0, 1.0)
21+
[HDR] _LavaEmmisiveLow("Lava Emmisive Low", Color) = (1.0, 0.0, 0.0, 1.0)
2122
_Noise("Noise", 2D) = "gray" {}
2223
_FlowThreshold("Flow Threshold", Range(1.0, 2.0)) = 0.5
2324
_FlowIntensity("Flow Intensity", Range(0.0, 1.0)) = 0.2
@@ -70,6 +71,7 @@ inline float DistanceFunction(float3 pos)
7071
// @endblock
7172

7273
// @block PostEffect
74+
float4 _LavaEmmisiveLow;
7375
float4 _LavaEmmisiveHigh;
7476
sampler2D _Noise;
7577
float _FlowThreshold;
@@ -130,7 +132,9 @@ float lavaFlow(in vec2 p)
130132

131133
inline void PostEffect(RaymarchInfo ray, inout PostEffectOutput o)
132134
{
133-
o.emission = step(ray.endPos.y, _FlowThreshold + _FlowIntensity * lavaFlow(ray.endPos.xz)) * _LavaEmmisiveHigh;
135+
float flow = lavaFlow(ray.endPos.xz);
136+
float4 emission = lerp(_LavaEmmisiveLow, _LavaEmmisiveHigh, saturate(remap(flow, 0.6, 0.7)));
137+
o.emission = step(ray.endPos.y, _FlowThreshold + _FlowIntensity * flow) * emission;
134138
// o.emission = lavaFlow(ray.endPos.xz) * _LavaEmmisiveHigh;
135139
}
136140
// @endblock

Assets/Demoscene/Shaders/Includes/Common.cginc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
#ifndef __COMMON__
22
#define __COMMON__
33

4+
float remap(float s, float a1, float a2, float b1, float b2)
5+
{
6+
return b1 + (s - a1 ) * (b2 - b1) / (a2 - a1);
7+
}
8+
9+
float remap(float s, float a1, float a2)
10+
{
11+
return (s - a1 ) / (a2 - a1);
12+
}
13+
414
float2x2 rotateMat(float theta)
515
{
616
float c = cos(theta);

0 commit comments

Comments
 (0)