Skip to content

Commit 5d9fccb

Browse files
authored
Merge pull request #8 from gam0022/lava
Lava
2 parents d3fd1c1 + 92e95a2 commit 5d9fccb

File tree

17 files changed

+984
-9
lines changed

17 files changed

+984
-9
lines changed

.idea/.idea.unity-demoscene/.idea/contentModel.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Demoscene/Projects/2018-05-28-Sandwich/Sandwich.unity

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@ Transform:
223223
m_PrefabParentObject: {fileID: 0}
224224
m_PrefabInternal: {fileID: 0}
225225
m_GameObject: {fileID: 509048559}
226-
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
227-
m_LocalPosition: {x: -0.04410826, y: 0.60638976, z: 11.041107}
228-
m_LocalScale: {x: 0.0001, y: 0.0001, z: 0.0001}
226+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
227+
m_LocalPosition: {x: 0, y: 0, z: 1}
228+
m_LocalScale: {x: 1, y: 1, z: 1}
229229
m_Children: []
230230
m_Father: {fileID: 1561136793}
231231
m_RootOrder: 0
@@ -252,7 +252,7 @@ MeshRenderer:
252252
m_Enabled: 1
253253
m_CastShadows: 0
254254
m_ReceiveShadows: 1
255-
m_DynamicOccludee: 1
255+
m_DynamicOccludee: 0
256256
m_MotionVectors: 0
257257
m_LightProbeUsage: 0
258258
m_ReflectionProbeUsage: 1

Assets/Demoscene/Projects/2018-05-28-Sandwich/uRaymarchingShaders/WorldSandwich.mat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Material:
2020
m_TexEnvs: []
2121
m_Floats:
2222
- _Glossiness: 0.5
23-
- _LocalTime: 0
23+
- _LocalTime: 1.9688673
2424
- _Loop: 100
2525
- _Metallic: 0.5
2626
- _MinDistance: 0.01

Assets/Demoscene/Projects/2018-07-10-Cellular/Cellular.shader

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#pragma multi_compile_fog
1919

2020
#include "UnityCG.cginc"
21-
#include "Assets/Demoscene/Shaders/Includes/PortingFromGLSL.cginc"
2221
#include "Assets/Demoscene/Shaders/Includes/Noise.cginc"
2322

2423
struct appdata

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

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_PrefabParentObject: {fileID: 0}
7+
m_PrefabInternal: {fileID: 0}
8+
m_GameObject: {fileID: 0}
9+
m_Enabled: 1
10+
m_EditorHideFlags: 0
11+
m_Script: {fileID: 11500000, guid: 3acd6fe57257048db802c1c4c2b75248, type: 3}
12+
m_Name: Lava
13+
m_EditorClassIdentifier:
14+
shaderName: Lava
15+
shaderReference: {fileID: 4800000, guid: 5c314efc8c9d8449ab45d6dd0183c06e, type: 3}
16+
shaderTemplate: uRaymarching/Direct GBuffer Custom
17+
variables:
18+
- key: Name
19+
value: Lava
20+
- key: Culling
21+
value: Off
22+
- key: RaymarchingShaderDirectory
23+
value: Assets/uRaymarching/Shaders/Include
24+
conditions:
25+
- key: ShadowCaster
26+
value: 1
27+
- key: WorldSpace
28+
value: 1
29+
- key: FollowObjectScale
30+
value: 0
31+
- key: DoNotOutputDepth
32+
value: 0
33+
- key: CameraInsideObject
34+
value: 0
35+
- key: FallbackToDiffuse
36+
value: 1
37+
blocks:
38+
- key: Properties
39+
value: // _Color2("Color2", Color) = (1.0, 1.0, 1.0, 1.0)
40+
folded: 0
41+
- key: DistanceFunction
42+
value: "inline float DistanceFunction(float3 pos)\n{\n return Sphere(pos, 0.5);\n}"
43+
folded: 0
44+
- key: PostEffect
45+
value: 'inline void PostEffect(RaymarchInfo ray, inout PostEffectOutput o)
46+
47+
{
48+
49+
}'
50+
folded: 0
51+
constants: {fileID: 11400000, guid: 4df15a420345e4af98645ddd9620aa5b, type: 2}
52+
basicFolded: 1
53+
conditionsFolded: 0
54+
variablesFolded: 0
55+
materialsFolded: 0
56+
constantsFolded: 1

Assets/Demoscene/Projects/2018-07-12-Lava/Lava.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!21 &2100000
4+
Material:
5+
serializedVersion: 6
6+
m_ObjectHideFlags: 0
7+
m_PrefabParentObject: {fileID: 0}
8+
m_PrefabInternal: {fileID: 0}
9+
m_Name: Lava
10+
m_Shader: {fileID: 4800000, guid: 5c314efc8c9d8449ab45d6dd0183c06e, type: 3}
11+
m_ShaderKeywords:
12+
m_LightmapFlags: 4
13+
m_EnableInstancingVariants: 0
14+
m_DoubleSidedGI: 0
15+
m_CustomRenderQueue: -1
16+
stringTagMap: {}
17+
disabledShaderPasses: []
18+
m_SavedProperties:
19+
serializedVersion: 3
20+
m_TexEnvs: []
21+
m_Floats:
22+
- _Loop: 99.2
23+
- _MinDistance: 0.01
24+
- _Power: 0.038
25+
- _ShadowExtraBias: 0.802
26+
- _ShadowLoop: 10
27+
- _ShadowMinDistance: 0.01
28+
- _Threshold: 1.38
29+
m_Colors:
30+
- _Diffuse: {r: 0.9528302, g: 0.004494493, b: 0.004494493, a: 1}
31+
- _Emission: {r: 0, g: 0, b: 0, a: 0}
32+
- _Lava: {r: 1, g: 0.24644177, b: 0, a: 1}
33+
- _Specular: {r: 0, g: 0, b: 0, a: 0}

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

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
Shader "Raymarching/Lava"
2+
{
3+
4+
Properties
5+
{
6+
[Header(GBuffer)]
7+
_Diffuse("Diffuse", Color) = (1.0, 1.0, 1.0, 1.0)
8+
_Specular("Specular", Color) = (0.0, 0.0, 0.0, 0.0)
9+
_Emission("Emission", Color) = (0.0, 0.0, 0.0, 0.0)
10+
11+
[Header(Raymarching Settings)]
12+
_Loop("Loop", Range(1, 100)) = 30
13+
_MinDistance("Minimum Distance", Range(0.001, 0.1)) = 0.01
14+
_ShadowLoop("Shadow Loop", Range(1, 100)) = 10
15+
_ShadowMinDistance("Shadow Minimum Distance", Range(0.001, 0.1)) = 0.01
16+
_ShadowExtraBias("Shadow Extra Bias", Range(0.0, 1.0)) = 0.01
17+
18+
// @block Properties
19+
// _Color2("Color2", Color) = (1.0, 1.0, 1.0, 1.0)
20+
_Threshold("Threshold", Range(1.0, 2.0)) = 0.5
21+
_Power("Power", Range(0.0, 1.0)) = 0.5
22+
[HDR] _Lava("Lava", Color) = (1.0, 0.0, 0.0, 1.0)
23+
// @endblock
24+
}
25+
26+
SubShader
27+
{
28+
29+
Tags
30+
{
31+
"RenderType" = "Opaque"
32+
"DisableBatching" = "True"
33+
}
34+
35+
Cull Off
36+
37+
CGINCLUDE
38+
39+
#define WORLD_SPACE
40+
41+
#define DISTANCE_FUNCTION DistanceFunction
42+
#define POST_EFFECT PostEffect
43+
#define PostEffectOutput GBufferOut
44+
45+
#include "Assets/uRaymarching/Shaders/Include/Common.cginc"
46+
#include "Assets/uRaymarchingCustom/Common.cginc"
47+
48+
// @block DistanceFunction
49+
#include "Assets/Demoscene/Shaders/Includes/Noise.cginc"
50+
51+
float _Threshold;
52+
float _Power;
53+
54+
inline float DistanceFunction(float3 pos)
55+
{
56+
float2 c = cellular(float2(pos.xz));
57+
float h = c.y - c.x;
58+
h = pow(h, _Power);
59+
60+
float2 c2 = cellular(float2(3.0 * pos.xz));
61+
h += 0.5 * pow((c2.y - c2.x), _Power);
62+
63+
h += 0.001 * snoise(50.0 * pos.xz);
64+
return pos.y - h;
65+
}
66+
// @endblock
67+
68+
// @block PostEffect
69+
float4 _Lava;
70+
inline void PostEffect(RaymarchInfo ray, inout PostEffectOutput o)
71+
{
72+
o.emission = step(ray.endPos.y, _Threshold) * _Lava;
73+
}
74+
// @endblock
75+
76+
#include "Assets/uRaymarching/Shaders/Include/Raymarching.cginc"
77+
78+
ENDCG
79+
80+
Pass
81+
{
82+
Tags { "LightMode" = "Deferred" }
83+
84+
Stencil
85+
{
86+
Comp Always
87+
Pass Replace
88+
Ref 128
89+
}
90+
91+
CGPROGRAM
92+
#include "Assets/uRaymarching/Shaders/Include/VertFragDirectScreen.cginc"
93+
#pragma target 3.0
94+
#pragma vertex Vert
95+
#pragma fragment Frag
96+
#pragma exclude_renderers nomrt
97+
#pragma multi_compile_prepassfinal
98+
#pragma multi_compile ___ UNITY_HDR_ON
99+
#pragma multi_compile OBJECT_SHAPE_CUBE OBJECT_SHAPE_SPHERE ___
100+
ENDCG
101+
}
102+
103+
Pass
104+
{
105+
Tags { "LightMode" = "ShadowCaster" }
106+
107+
CGPROGRAM
108+
#include "Assets/uRaymarching/Shaders/Include/VertFragShadowObject.cginc"
109+
#pragma target 3.0
110+
#pragma vertex Vert
111+
#pragma fragment Frag
112+
#pragma fragmentoption ARB_precision_hint_fastest
113+
#pragma multi_compile_shadowcaster
114+
#pragma multi_compile OBJECT_SHAPE_CUBE OBJECT_SHAPE_SPHERE ___
115+
ENDCG
116+
}
117+
118+
}
119+
120+
Fallback "Diffuse"
121+
122+
CustomEditor "uShaderTemplate.MaterialEditor"
123+
124+
}

0 commit comments

Comments
 (0)