so much raymarcing garbage
This commit is contained in:
parent
4695be0423
commit
fdfa51a531
38 changed files with 2939 additions and 205 deletions
80
Assets/raymarched/lib/GarbageExample.mat
Normal file
80
Assets/raymarched/lib/GarbageExample.mat
Normal file
|
@ -0,0 +1,80 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: GarbageExample
|
||||
m_Shader: {fileID: 4800000, guid: 7d4f97b3ee7613d9ba63c8ab411721a1, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _MaxDist: 256
|
||||
- _MaxSteps: 256
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _SurfDist: 0.001
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
8
Assets/raymarched/lib/GarbageExample.mat.meta
Normal file
8
Assets/raymarched/lib/GarbageExample.mat.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 162568fe26f57e5c5acca748512ee245
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
61
Assets/raymarched/lib/libgarbage.cginc
Normal file
61
Assets/raymarched/lib/libgarbage.cginc
Normal file
|
@ -0,0 +1,61 @@
|
|||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float3 vCamPos : TEXCOORD1;
|
||||
float3 vHitPos : TEXCOORD2;
|
||||
};
|
||||
|
||||
struct fragOut
|
||||
{
|
||||
fixed4 col : SV_Target;
|
||||
// float depth : SV_Depth;
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
#ifdef USE_WORLD_SPACE
|
||||
o.vCamPos = _WorldSpaceCameraPos;
|
||||
o.vHitPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
#else
|
||||
o.vCamPos = mul(unity_WorldToObject, float4(_WorldSpaceCameraPos, 1));
|
||||
o.vHitPos = v.vertex;
|
||||
#endif
|
||||
return o;
|
||||
}
|
||||
|
||||
fragOut frag (v2f i)
|
||||
{
|
||||
fragOut o;
|
||||
o.col = 1;
|
||||
o.col.r = 0;
|
||||
return o;
|
||||
}
|
||||
|
||||
// #define SOME_MAGIC(main_fn) float3 main1()\
|
||||
// main_fn \
|
||||
|
||||
#define SOME_MAGIC(PASS, function_definition) float3 main##PASS() function_definition
|
||||
|
||||
#define DO_MAGIC MAIN_FN(1)
|
||||
|
||||
// #define SECOND_PASS 1
|
||||
// #define AA MAIN_FN
|
||||
// #define BB MAIN_FN
|
||||
|
||||
|
||||
// float3 main2() \
|
||||
// main_fn
|
||||
|
||||
// \
|
||||
// float3 main2() \
|
||||
// main_fn\
|
||||
|
||||
|
||||
// #define SECOND_PASS \
|
9
Assets/raymarched/lib/libgarbage.cginc.meta
Normal file
9
Assets/raymarched/lib/libgarbage.cginc.meta
Normal file
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1b7c0fe7c2a1f3e5bb00d9fc04e6c43c
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
1
Assets/raymarched/lib/libgarbage_end.cginc
Normal file
1
Assets/raymarched/lib/libgarbage_end.cginc
Normal file
|
@ -0,0 +1 @@
|
|||
#define DO_MAGIC(p) MAIN_FN(p)
|
9
Assets/raymarched/lib/libgarbage_end.cginc.meta
Normal file
9
Assets/raymarched/lib/libgarbage_end.cginc.meta
Normal file
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 26203816190e7e521a12959d895d68a3
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
44
Assets/raymarched/lib/libgarbage_example.shader
Normal file
44
Assets/raymarched/lib/libgarbage_example.shader
Normal file
|
@ -0,0 +1,44 @@
|
|||
Shader "CrispyPin/LibGarbageExample"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
|
||||
[Header(Raymarcher Properties)]
|
||||
_MaxSteps ("Max steps", Int) = 256
|
||||
_MaxDist ("Max distance", Float) = 256
|
||||
_SurfDist ("Surface distance threshold", Range(0.00001, 0.05)) = 0.001
|
||||
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
Cull Off
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "libgarbage.cginc"
|
||||
|
||||
// #define MAIN_FN(PASS) float3 main##PASS ()\
|
||||
|
||||
#define MAIN_FN(PASS) SOME_MAGIC(PASS,\
|
||||
{\
|
||||
return float3(1,0,0);\
|
||||
}\
|
||||
)
|
||||
// #include "libgarbage_end.cginc"
|
||||
// #define DO_MAGIC(p) MAIN_FN(p)
|
||||
DO_MAGIC
|
||||
|
||||
// {return 0;}
|
||||
// MAIN_FN(1) {return 0;}
|
||||
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
9
Assets/raymarched/lib/libgarbage_example.shader.meta
Normal file
9
Assets/raymarched/lib/libgarbage_example.shader.meta
Normal file
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7d4f97b3ee7613d9ba63c8ab411721a1
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue