Skip to content

Commit 2f7984f

Browse files
committed
Fix for uRaymarching v0.0.4
1 parent 71600f7 commit 2f7984f

File tree

8 files changed

+95
-23
lines changed

8 files changed

+95
-23
lines changed

Assets/Demoscene/TheGlow/TheGlowWorld.shader

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,12 @@ CGINCLUDE
3636

3737
#define WORLD_SPACE
3838

39-
40-
41-
4239
#define DISTANCE_FUNCTION DistanceFunction
4340
#define POST_EFFECT PostEffect
4441
#define PostEffectOutput GBufferOut
4542

46-
#include "Assets/Raymarching/Shaders/Include/Common.cginc"
43+
#include "Assets/uRaymarching/Shaders/Include/Common.cginc"
44+
#include "Assets/uRaymarchingCustom/Common.cginc"
4745

4846
// @block DistanceFunction
4947
#define PI2 (2.0 * PI)
@@ -129,7 +127,7 @@ inline void PostEffect(RaymarchInfo ray, inout PostEffectOutput o)
129127
}
130128
// @endblock
131129

132-
#include "Assets/Raymarching/Shaders/Include/Raymarching.cginc"
130+
#include "Assets/uRaymarching/Shaders/Include/Raymarching.cginc"
133131

134132
ENDCG
135133

@@ -145,35 +143,21 @@ Pass
145143
}
146144

147145
CGPROGRAM
148-
#include "Assets/Raymarching/Shaders/Include/VertFragDirectScreen.cginc"
146+
#include "Assets/uRaymarching/Shaders/Include/VertFragDirectScreen.cginc"
149147
#pragma target 3.0
150148
#pragma vertex Vert
151149
#pragma fragment Frag
152-
#pragma multi_compile_prepassfinal
153-
#pragma multi_compile OBJECT_SHAPE_CUBE OBJECT_SHAPE_SPHERE ___
154150
#pragma exclude_renderers nomrt
155-
ENDCG
156-
}
157-
158-
Pass
159-
{
160-
Tags { "LightMode" = "ShadowCaster" }
161-
162-
CGPROGRAM
163-
#include "Assets/Raymarching/Shaders/Include/VertFragShadowObject.cginc"
164-
#pragma target 3.0
165-
#pragma vertex Vert
166-
#pragma fragment Frag
167-
#pragma multi_compile_shadowcaster
151+
#pragma multi_compile_prepassfinal
152+
#pragma multi_compile ___ UNITY_HDR_ON
168153
#pragma multi_compile OBJECT_SHAPE_CUBE OBJECT_SHAPE_SPHERE ___
169-
#pragma fragmentoption ARB_precision_hint_fastest
170154
ENDCG
171155
}
172156

173157
}
174158

175159
Fallback Off
176160

177-
CustomEditor "Raymarching.MaterialEditor"
161+
CustomEditor "uShaderTemplate.MaterialEditor"
178162

179163
}

Assets/uRaymarchingCustom.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#ifndef CUSTOM_COMMON_H
2+
#define CUSTOM_COMMON_H
3+
4+
//float3 _Scale = float3(1, 1, 1);
5+
6+
//#define UNITY_PASS_DEFERRED
7+
//#include "UnityCG.cginc"
8+
//#include "UnityPBSLighting.cginc"
9+
//#include "./Structs.cginc"
10+
//#include "./Utils.cginc"
11+
//#include "./Camera.cginc"
12+
#include "./Math.cginc"
13+
#include "./Primitives.cginc"
14+
15+
#endif

Assets/uRaymarchingCustom/Common.cginc.meta

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

Assets/uRaymarchingCustom/Math.cginc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#ifndef CUSTOM_MATH_H
2+
#define CUSTOM_MATH_H
3+
4+
#include "Assets/uRaymarching/Shaders/Include/Math.cginc"
5+
6+
inline float RepeatLimit(float pos, float span, float limit)
7+
{
8+
return Mod(clamp(pos, -limit, limit), span) - span * 0.5;
9+
}
10+
11+
inline float2 RepeatLimit(float2 pos, float2 span, float2 limit)
12+
{
13+
return Mod(clamp(pos, -limit, limit), span) - span * 0.5;
14+
}
15+
16+
inline float3 RepeatLimit(float3 pos, float3 span, float3 limit)
17+
{
18+
return Mod(clamp(pos, -limit, limit), span) - span * 0.5;
19+
}
20+
21+
#endif

Assets/uRaymarchingCustom/Math.cginc.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef CUSTOM_PRIMITIVES_H
2+
#define CUSTOM_PRIMITIVES_H
3+
4+
#include "Assets/uRaymarching/Shaders/Include/Primitives.cginc"
5+
6+
inline float sdBox(float3 p, float3 b)
7+
{
8+
float3 d = abs(p) - b;
9+
return min(max(d.x,max(d.y,d.z)),0.0) + length(max(d,0.0));
10+
}
11+
12+
#endif

Assets/uRaymarchingCustom/Primitives.cginc.meta

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

0 commit comments

Comments
 (0)