Skip to content

Commit f84719a

Browse files
committed
Add Assets/uShaderTemplate, Assets/uRaymarching
1 parent 8ef2911 commit f84719a

File tree

145 files changed

+7558
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+7558
-0
lines changed

Assets/uRaymarching.meta

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

Assets/uRaymarching/Editor.meta

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

Assets/uRaymarching/Editor/Resources.meta

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

Assets/uRaymarching/Editor/Resources/ShaderTemplates.meta

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

Assets/uRaymarching/Editor/Resources/ShaderTemplates/uRaymarching.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: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
Shader "Raymarching/<Name>"
2+
{
3+
4+
@constants uRaymarching/Constants/uRaymarching Default Constants
5+
6+
Properties
7+
{
8+
[Header(GBuffer)]
9+
_Diffuse("Diffuse", Color) = (1.0, 1.0, 1.0, 1.0)
10+
_Specular("Specular", Color) = (0.0, 0.0, 0.0, 0.0)
11+
_Emission("Emission", Color) = (0.0, 0.0, 0.0, 0.0)
12+
13+
[Header(Raymarching Settings)]
14+
_Loop("Loop", Range(1, 100)) = 30
15+
_MinDistance("Minimum Distance", Range(0.001, 0.1)) = 0.01
16+
@if ShadowCaster : true
17+
_ShadowLoop("Shadow Loop", Range(1, 100)) = 10
18+
_ShadowMinDistance("Shadow Minimum Distance", Range(0.001, 0.1)) = 0.01
19+
_ShadowExtraBias("Shadow Extra Bias", Range(0.0, 1.0)) = 0.01
20+
@endif
21+
22+
@block Properties
23+
// _Color2("Color2", Color) = (1.0, 1.0, 1.0, 1.0)
24+
@endblock
25+
}
26+
27+
SubShader
28+
{
29+
30+
Tags
31+
{
32+
"RenderType" = "Opaque"
33+
"DisableBatching" = "True"
34+
}
35+
36+
Cull <Culling=Off|Back|Front>
37+
38+
CGINCLUDE
39+
40+
@if WorldSpace : false
41+
#define WORLD_SPACE
42+
@endif
43+
@if FollowObjectScale : false
44+
#define OBJECT_SCALE
45+
@endif
46+
@if DoNotOutputDepth
47+
#define DO_NOT_OUTPUT_DEPTH
48+
@endif
49+
@if CameraInsideObject : false
50+
#define CAMERA_INSIDE_OBJECT
51+
@endif
52+
53+
#define DISTANCE_FUNCTION DistanceFunction
54+
#define POST_EFFECT PostEffect
55+
#define PostEffectOutput GBufferOut
56+
57+
#include "<RaymarchingShaderDirectory>/Common.cginc"
58+
59+
@block DistanceFunction
60+
inline float DistanceFunction(float3 pos)
61+
{
62+
return Sphere(pos, 0.5);
63+
}
64+
@endblock
65+
66+
@block PostEffect
67+
inline void PostEffect(RaymarchInfo ray, inout PostEffectOutput o)
68+
{
69+
}
70+
@endblock
71+
72+
#include "<RaymarchingShaderDirectory>/Raymarching.cginc"
73+
74+
ENDCG
75+
76+
Pass
77+
{
78+
Tags { "LightMode" = "Deferred" }
79+
80+
Stencil
81+
{
82+
Comp Always
83+
Pass Replace
84+
Ref 128
85+
}
86+
87+
CGPROGRAM
88+
@if WorldSpace
89+
#include "<RaymarchingShaderDirectory>/VertFragDirectScreen.cginc"
90+
@else
91+
#include "<RaymarchingShaderDirectory>/VertFragDirectObject.cginc"
92+
@endif
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+
@if ShadowCaster
104+
Pass
105+
{
106+
Tags { "LightMode" = "ShadowCaster" }
107+
108+
CGPROGRAM
109+
#include "<RaymarchingShaderDirectory>/VertFragShadowObject.cginc"
110+
#pragma target 3.0
111+
#pragma vertex Vert
112+
#pragma fragment Frag
113+
#pragma fragmentoption ARB_precision_hint_fastest
114+
#pragma multi_compile_shadowcaster
115+
#pragma multi_compile OBJECT_SHAPE_CUBE OBJECT_SHAPE_SPHERE ___
116+
ENDCG
117+
}
118+
@endif
119+
120+
}
121+
122+
@if FallbackToDiffuse : true
123+
Fallback "Diffuse"
124+
@else
125+
Fallback Off
126+
@endif
127+
128+
CustomEditor "uShaderTemplate.MaterialEditor"
129+
130+
}

Assets/uRaymarching/Editor/Resources/ShaderTemplates/uRaymarching/Direct GBuffer.txt.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: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
Shader "Raymarching/<Name>"
2+
{
3+
4+
@constants uRaymarching/Constants/uRaymarching Default Constants
5+
6+
Properties
7+
{
8+
[Header(PBS)]
9+
_Color("Color", Color) = (1.0, 1.0, 1.0, 1.0)
10+
_Metallic("Metallic", Range(0.0, 1.0)) = 0.5
11+
_Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
12+
13+
[Header(Raymarching Settings)]
14+
_Loop("Loop", Range(1, 100)) = 30
15+
_MinDistance("Minimum Distance", Range(0.001, 0.1)) = 0.01
16+
@if ShadowCaster : true
17+
_ShadowLoop("Shadow Loop", Range(1, 100)) = 10
18+
_ShadowMinDistance("Shadow Minimum Distance", Range(0.001, 0.1)) = 0.01
19+
_ShadowExtraBias("Shadow Extra Bias", Range(0.0, 1.0)) = 0.01
20+
@endif
21+
22+
@block Properties
23+
// _Color2("Color2", Color) = (1.0, 1.0, 1.0, 1.0)
24+
@endblock
25+
}
26+
27+
SubShader
28+
{
29+
30+
Tags
31+
{
32+
"RenderType" = "Opaque"
33+
"DisableBatching" = "True"
34+
}
35+
36+
Cull <Culling=Back|Front|Off>
37+
38+
CGINCLUDE
39+
40+
@if FollowObjectScale : false
41+
#define OBJECT_SCALE
42+
@endif
43+
@if DoNotOutputDepth : false
44+
#define DO_NOT_OUTPUT_DEPTH
45+
@endif
46+
@if SphericalHarmonicsPerPixel : true
47+
#define SPHERICAL_HARMONICS_PER_PIXEL
48+
@endif
49+
@if CameraInsideObject : false
50+
#define CAMERA_INSIDE_OBJECT
51+
@endif
52+
53+
#define DISTANCE_FUNCTION DistanceFunction
54+
#define POST_EFFECT PostEffect
55+
#define PostEffectOutput SurfaceOutputStandard
56+
57+
#include "<RaymarchingShaderDirectory>/Common.cginc"
58+
59+
@block DistanceFunction
60+
inline float DistanceFunction(float3 pos)
61+
{
62+
return Sphere(pos, 0.5);
63+
}
64+
@endblock
65+
66+
@block PostEffect
67+
inline void PostEffect(RaymarchInfo ray, inout PostEffectOutput o)
68+
{
69+
}
70+
@endblock
71+
72+
#include "<RaymarchingShaderDirectory>/Raymarching.cginc"
73+
74+
ENDCG
75+
76+
Pass
77+
{
78+
Tags { "LightMode" = "Deferred" }
79+
80+
Stencil
81+
{
82+
Comp Always
83+
Pass Replace
84+
Ref 128
85+
}
86+
87+
CGPROGRAM
88+
#include "<RaymarchingShaderDirectory>/VertFragStandardObject.cginc"
89+
#pragma target 3.0
90+
#pragma vertex Vert
91+
#pragma fragment Frag
92+
#pragma exclude_renderers nomrt
93+
#pragma multi_compile_prepassfinal
94+
#pragma multi_compile ___ UNITY_HDR_ON
95+
#pragma multi_compile OBJECT_SHAPE_CUBE OBJECT_SHAPE_SPHERE ___
96+
ENDCG
97+
}
98+
99+
@if ShadowCaster
100+
Pass
101+
{
102+
Tags { "LightMode" = "ShadowCaster" }
103+
104+
CGPROGRAM
105+
#include "<RaymarchingShaderDirectory>/VertFragShadowObject.cginc"
106+
#pragma target 3.0
107+
#pragma vertex Vert
108+
#pragma fragment Frag
109+
#pragma fragmentoption ARB_precision_hint_fastest
110+
#pragma multi_compile_shadowcaster
111+
#pragma multi_compile OBJECT_SHAPE_CUBE OBJECT_SHAPE_SPHERE ___
112+
ENDCG
113+
}
114+
@endif
115+
116+
}
117+
118+
@if FallbackToStandardShader : true
119+
Fallback "Raymarching/Fallbacks/StandardSurfaceShader"
120+
@else
121+
Fallback Off
122+
@endif
123+
124+
CustomEditor "uShaderTemplate.MaterialEditor"
125+
126+
}

Assets/uRaymarching/Editor/Resources/ShaderTemplates/uRaymarching/Standard.txt.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.

Assets/uRaymarching/Editor/Resources/uRaymarching.meta

Lines changed: 9 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)