diff --git a/Assets/raymarched/Raymarching.unity b/Assets/raymarched/Raymarching.unity index 81ef64b..7139b27 100644 --- a/Assets/raymarched/Raymarching.unity +++ b/Assets/raymarched/Raymarching.unity @@ -122,6 +122,162 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &34125273 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 34125280} + - component: {fileID: 34125279} + - component: {fileID: 34125278} + - component: {fileID: 34125277} + - component: {fileID: 34125276} + - component: {fileID: 34125275} + - component: {fileID: 34125274} + m_Layer: 0 + m_Name: GlitchSphere + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &34125274 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 34125273} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 990f6f4efb7f4ec98ad99f6dff1bc6f6, type: 3} + m_Name: + m_EditorClassIdentifier: + type: 3 + objectId: 94d9cfa6-b350-4290-abeb-7b1692bf2c6e + randomNum: 60695246 + unityVersion: 2021.3.41f1 + cckVersion: 3.10:132 +--- !u!114 &34125275 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 34125273} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a37fd8d654d5c2840a0ab3a5ad65a5ae, type: 3} + m_Name: + m_EditorClassIdentifier: + spawnHeight: 0.55 + useAdditionalValues: 0 + syncValues: [] + propPrivacy: 1 + subSyncs: [] + spawnableType: 0 + preGeneratedInstanceId: +--- !u!114 &34125276 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 34125273} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 12974925555b471580cacf5d2d5fa9e3, type: 3} + m_Name: + m_EditorClassIdentifier: + gripType: 1 + gripOrigin: {fileID: 0} + disallowTheft: 0 + maximumGrabDistance: 0 + snappingReferences: [] + autoHold: 0 + updateWithPhysics: 1 + ikReference: {fileID: 0} +--- !u!65 &34125277 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 34125273} + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &34125278 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 34125273} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: eae55803092aaf7e1801b72b6663512b, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &34125279 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 34125273} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &34125280 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 34125273} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -1, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 13 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &244150317 GameObject: m_ObjectHideFlags: 0 @@ -1459,7 +1615,7 @@ MonoBehaviour: m_EditorClassIdentifier: type: 3 objectId: e51ea4c1-d42c-4790-91a1-78d2bf6fef59 - randomNum: 81522144 + randomNum: 42815474 unityVersion: 2021.3.41f1 cckVersion: 3.10:132 --- !u!114 &853608961 @@ -1572,7 +1728,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 853608959} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 0, y: 0, z: -2} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -2570,7 +2726,7 @@ Camera: m_Enabled: 1 serializedVersion: 2 m_ClearFlags: 2 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_BackGroundColor: {r: 0.1792453, g: 0.1792453, b: 0.1792453, a: 0} m_projectionMatrixMode: 1 m_GateFitMode: 2 m_FOVAxisMode: 0 @@ -2611,7 +2767,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1500710831} m_LocalRotation: {x: 0.30261943, y: 0, z: 0, w: 0.95311147} - m_LocalPosition: {x: 0, y: 0.52, z: -0.92} + m_LocalPosition: {x: 0, y: 0.8, z: -1.2} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -2917,6 +3073,162 @@ MonoBehaviour: maxValue: 1 updateMethod: 1 sampleDirection: 4 +--- !u!1 &2089314929 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2089314936} + - component: {fileID: 2089314935} + - component: {fileID: 2089314934} + - component: {fileID: 2089314933} + - component: {fileID: 2089314932} + - component: {fileID: 2089314931} + - component: {fileID: 2089314930} + m_Layer: 0 + m_Name: FleshCube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2089314930 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2089314929} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 990f6f4efb7f4ec98ad99f6dff1bc6f6, type: 3} + m_Name: + m_EditorClassIdentifier: + type: 3 + objectId: 4e7f3dcf-e925-473a-89e2-dfe6cfe7eac5 + randomNum: 77268264 + unityVersion: 2021.3.41f1 + cckVersion: 3.10:132 +--- !u!114 &2089314931 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2089314929} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a37fd8d654d5c2840a0ab3a5ad65a5ae, type: 3} + m_Name: + m_EditorClassIdentifier: + spawnHeight: 0.55 + useAdditionalValues: 0 + syncValues: [] + propPrivacy: 1 + subSyncs: [] + spawnableType: 0 + preGeneratedInstanceId: +--- !u!114 &2089314932 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2089314929} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 12974925555b471580cacf5d2d5fa9e3, type: 3} + m_Name: + m_EditorClassIdentifier: + gripType: 1 + gripOrigin: {fileID: 0} + disallowTheft: 0 + maximumGrabDistance: 0 + snappingReferences: [] + autoHold: 0 + updateWithPhysics: 1 + ikReference: {fileID: 0} +--- !u!65 &2089314933 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2089314929} + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &2089314934 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2089314929} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a58263543abc75cc7a798853827cd868, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &2089314935 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2089314929} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &2089314936 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2089314929} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.005, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 14 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2089960365 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/raymarched/bocs.shader b/Assets/raymarched/bocs.shader index 39d77f6..219f831 100644 --- a/Assets/raymarched/bocs.shader +++ b/Assets/raymarched/bocs.shader @@ -47,11 +47,18 @@ Shader "CrispyPin/Bocs" return s * a + (1 - s) * b; } - SurfacePoint Boc(float3 p, float t) { + Material gridtexture(float3 p) { + return mat(checkers(p + BOX_SIZE/2 , 0.35, 0.45, BOX_SIZE)); + } + + SurfacePoint Boc(float3 p, float t, float3 grid_transform = float3(1,1,1)) { float x = smoothstep(0, .5, fmod(t, 4) - .5) * RADIUS; float z = smoothstep(1, .5, fmod(t, 4) - 2) * RADIUS; float y = smoothstep(.25, .75, abs(fmod(t - .75, 2) - 1)) * BOX_SIZE * 2 - BOX_SIZE / 2; - return mBox(p - float3(x,y,z), BOX_SIZE, mat(.05, .8, .8)); + return mBox(p - float3(x,y,z), BOX_SIZE, + // mat(.05, .8, .8) + gridtexture((p - float3(x,y,z)) * grid_transform) + ); } SurfacePoint main(float3 p) { @@ -59,7 +66,7 @@ Shader "CrispyPin/Bocs" // base const float base_width = BOX_SIZE * 6 - 0.01; - d = mBox(p - float3(0,-.15,0), float3(base_width, .3, base_width), mat(checkers(p + BOX_SIZE/2 , 0.35, 0.45, BOX_SIZE ))); + d = mBox(p - float3(0,-.15,0), float3(base_width, .3, base_width), gridtexture(p)); float t = _Time.y * SPEED; // holes @@ -74,12 +81,14 @@ Shader "CrispyPin/Bocs" float3 p2 = p * float3(-1,1,-1); d = qUnion(d, Boc(p2, t)); d = qUnion(d, Boc(p2, t + 2)); - float3 p3 = p.zyx * float3(-1,1,1); - d = qUnion(d, Boc(p3, t)); - d = qUnion(d, Boc(p3, t + 2)); - float3 p4 = p.zyx * float3(1,1,-1); - d = qUnion(d, Boc(p4, t)); - d = qUnion(d, Boc(p4, t + 2)); + const float3 flip_x = float3(-1,1,1); + const float3 flip_z = float3(1,1,-1); + float3 p3 = p.zyx * flip_x; + d = qUnion(d, Boc(p3, t, flip_x)); + d = qUnion(d, Boc(p3, t + 2, flip_x)); + float3 p4 = p.zyx * flip_z; + d = qUnion(d, Boc(p4, t, flip_x)); + d = qUnion(d, Boc(p4, t + 2, flip_x)); return d; } diff --git a/Assets/raymarched/flesh_cube.mat b/Assets/raymarched/flesh_cube.mat new file mode 100644 index 0000000..febfb83 --- /dev/null +++ b/Assets/raymarched/flesh_cube.mat @@ -0,0 +1,84 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: flesh_cube + m_Shader: {fileID: 4800000, guid: 39dabd8653500dc208f1e8018c20dbce, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: [] + 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_Ints: + - _MaxSteps: 128 + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _MaxDist: 128 + - _MaxSteps: 128 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SurfDist: 0.01 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/raymarched/flesh_cube.mat.meta b/Assets/raymarched/flesh_cube.mat.meta new file mode 100644 index 0000000..dda69aa --- /dev/null +++ b/Assets/raymarched/flesh_cube.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a58263543abc75cc7a798853827cd868 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/raymarched/flesh_cube.shader b/Assets/raymarched/flesh_cube.shader new file mode 100644 index 0000000..f20816b --- /dev/null +++ b/Assets/raymarched/flesh_cube.shader @@ -0,0 +1,67 @@ +Shader "CrispyPin/FleshCube2" +{ + Properties + { + [Header(Raymarcher Properties)] + _MaxSteps ("Max steps", Integer) = 128 + _MaxDist ("Max distance", Float) = 128 + _SurfDist ("Surface distance threshold", Range(.0001, .05)) = .001 + } + SubShader + { + Tags { "RenderType"="Opaque" } + Cull Front + LOD 100 + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + int _MaxSteps; + float _MaxDist; + float _SurfDist; + #define MAX_STEPS _MaxSteps + #define MAX_DIST _MaxDist + #define SURF_DIST _SurfDist + + + #define SCENE_FN main + //#define LIGHT_FN lighting + + #define SCENE_SCALE 0.04 + #define REFLECTIONS 2 + + #define DISCARD_ON_MISS + + #include "lib/libgarbage.cginc" + + #define SPEED 1.5 + + SurfacePoint main(float3 p) { + Material mRed = mat(.95, 0.1, 0.1, 0.4); + Material mCut = mat(.7, 0.2, 0.1, 0.4); + + SurfacePoint d; + + // base + float3 bias = -pow(sin(_Time*60 + p.y*0.1), 8)*.5+1.3; + d = mGyroid(p, .5, bias, 0.2, mCut); + + float3 gp = p + sin(_Time + p*0.1); + d.dist -= sdGyroid(gp, 1.63, .5, 0.2) * 0.3; + d.dist += sdGyroid(gp, 3.327, 0, 0.2) * 0.1; + d.dist += sdGyroid(gp, 7.351, .5, 0.2) * 0.1; + d.dist -= sdGyroid(gp, 17.351, .5, 0.2) * 0.05; + d.dist -= sdGyroid(gp, 23.521, .2, 0.2) * 0.05; + d = qUnion(d, mSphere(p, 6 + bias*3, mRed), 5); + + d = qIntersect(d, mBox(p, 25, mRed)); + + return d; + } + ENDCG + } + } +} diff --git a/Assets/raymarched/flesh_cube.shader.meta b/Assets/raymarched/flesh_cube.shader.meta new file mode 100644 index 0000000..54710d7 --- /dev/null +++ b/Assets/raymarched/flesh_cube.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 39dabd8653500dc208f1e8018c20dbce +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/raymarched/glitch_sphere.mat b/Assets/raymarched/glitch_sphere.mat new file mode 100644 index 0000000..1f3e886 --- /dev/null +++ b/Assets/raymarched/glitch_sphere.mat @@ -0,0 +1,84 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: glitch_sphere + m_Shader: {fileID: 4800000, guid: b7dfe294c2ddc5bc59d1744ba8ffc3f7, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: [] + 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_Ints: + - _MaxSteps: 128 + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _MaxDist: 32 + - _MaxSteps: 128 + - _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} + m_BuildTextureStacks: [] diff --git a/Assets/raymarched/glitch_sphere.mat.meta b/Assets/raymarched/glitch_sphere.mat.meta new file mode 100644 index 0000000..230a353 --- /dev/null +++ b/Assets/raymarched/glitch_sphere.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eae55803092aaf7e1801b72b6663512b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/raymarched/glitch_sphere.shader b/Assets/raymarched/glitch_sphere.shader new file mode 100644 index 0000000..96b68cc --- /dev/null +++ b/Assets/raymarched/glitch_sphere.shader @@ -0,0 +1,91 @@ +Shader "CrispyPin/Spheres" +{ + Properties + { + [Header(Raymarcher Properties)] + _MaxSteps ("Max steps", Integer) = 128 + _MaxDist ("Max distance", Float) = 128 + _SurfDist ("Surface distance threshold", Range(.0001, .05)) = .001 + } + SubShader + { + Tags { "RenderType"="Opaque" } + Cull Front + LOD 100 + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + int _MaxSteps; + float _MaxDist; + float _SurfDist; + #define MAX_STEPS _MaxSteps + #define MAX_DIST _MaxDist + #define SURF_DIST _SurfDist + + + #define SCENE_FN main + #define LIGHT_FN lighting + + // #define SCENE_SCALE 1 + + #define DISCARD_ON_MISS + + #include "lib/libgarbage.cginc" + + #define SPEED 1.5 + #define BOX_SIZE .15 + #define RADIUS BOX_SIZE*2 + + float3 checkers(float3 p, float3 a, float3 b, float2 size) { + float2 q = p.xz / size; + q = int2(abs(q) + .5); + int s = ((q.x + q.y) % 2); + return s * a + (1 - s) * b; + } + + SurfacePoint main(float3 p) { + SurfacePoint d; + const float COUNT_Y = 20; + const float COUNT_R = 20; + + float lat = asin(p.y) * COUNT_Y; + float long = atan2(p.z, p.x) * COUNT_R + _Time.y * 16; + float r = length(p); + // float grid = (1-abs(smoothstep(0, 0.5, sin(long))-0.5))*2 - 1; + float grid = (1-abs(smoothstep(0, 0.5, sin(lat))-0.5))*2 - 1; + d = mSphere(p, 0.21, + mat(abs(rotY(p, _Time.y*-4)/0.21)) + // mat(lat, long, grid) + ); + + // float long + lat = floor(lat+0.5)-0.5; + long = floor(long+0.5)-0.5; + float sx = sin(long); + float sz = cos(long); + float sy = sin(lat); + d = qUnion(d, mSphere(p - normalize(float3(sx, sy, sz))*r, 0.1)); + + return d; + } + + + float3 lighting(Ray ray) { + float3 sun_dir = normalize(float3(2, 1, -1)); + if (ray.missed) { + return lRenderSky(ray.dir, sun_dir); + } + float3 light = lSun(ray.normal, sun_dir); + // light *= lShadow(ray.hit_pos + ray.normal * SURF_DIST, sun_dir, 50); + light += lSky(ray.normal)*5; + return 1; + } + + ENDCG + } + } +} diff --git a/Assets/raymarched/glitch_sphere.shader.meta b/Assets/raymarched/glitch_sphere.shader.meta new file mode 100644 index 0000000..c8e3a29 --- /dev/null +++ b/Assets/raymarched/glitch_sphere.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b7dfe294c2ddc5bc59d1744ba8ffc3f7 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/raymarched/lib/libgarbage.cginc b/Assets/raymarched/lib/libgarbage.cginc index 9093fa3..d5f2f55 100644 --- a/Assets/raymarched/lib/libgarbage.cginc +++ b/Assets/raymarched/lib/libgarbage.cginc @@ -104,7 +104,7 @@ struct Material { }; #define DEFAULT_MAT {float3(1, 1, 1), 0} -Material mat(float3 col = float3(1, 1,1 ), float gloss = 0) { +Material mat(float3 col = float3(1, 1, 1), float gloss = 0) { Material m; m.col = col; m.gloss = gloss; @@ -113,6 +113,9 @@ Material mat(float3 col = float3(1, 1,1 ), float gloss = 0) { Material mat(float r, float g, float b) { return mat(float3(r, g, b)); } +Material mat(float r, float g, float b, float gloss) { + return mat(float3(r, g, b), gloss); +} struct SurfacePoint { float dist; diff --git a/UserSettings/Layouts/default-2021.dwlt b/UserSettings/Layouts/default-2021.dwlt index b214b62..dba8a8b 100644 --- a/UserSettings/Layouts/default-2021.dwlt +++ b/UserSettings/Layouts/default-2021.dwlt @@ -19,7 +19,7 @@ MonoBehaviour: width: 1920 height: 1029 m_ShowMode: 4 - m_Title: Scene + m_Title: Game m_RootView: {fileID: 6} m_MinSize: {x: 875, y: 300} m_MaxSize: {x: 10000, y: 10000} @@ -48,7 +48,7 @@ MonoBehaviour: m_MinSize: {x: 300, y: 200} m_MaxSize: {x: 24288, y: 16192} vertical: 0 - controlID: 15 + controlID: 100 --- !u!114 &3 MonoBehaviour: m_ObjectHideFlags: 52 @@ -68,8 +68,8 @@ MonoBehaviour: y: 0 width: 390 height: 979 - m_MinSize: {x: 276, y: 71} - m_MaxSize: {x: 4001, y: 4021} + m_MinSize: {x: 275, y: 50} + m_MaxSize: {x: 4000, y: 4000} m_ActualView: {fileID: 14} m_Panes: - {fileID: 14} @@ -111,7 +111,7 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 1 m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} - m_Name: + m_Name: ProjectBrowser m_EditorClassIdentifier: m_Children: [] m_Position: @@ -127,7 +127,7 @@ MonoBehaviour: - {fileID: 13} - {fileID: 18} m_Selected: 0 - m_LastSelected: 0 + m_LastSelected: 1 --- !u!114 &6 MonoBehaviour: m_ObjectHideFlags: 52 @@ -223,7 +223,7 @@ MonoBehaviour: m_MinSize: {x: 200, y: 200} m_MaxSize: {x: 16192, y: 16192} vertical: 1 - controlID: 16 + controlID: 89 --- !u!114 &10 MonoBehaviour: m_ObjectHideFlags: 52 @@ -248,7 +248,7 @@ MonoBehaviour: m_MinSize: {x: 200, y: 100} m_MaxSize: {x: 16192, y: 8096} vertical: 0 - controlID: 17 + controlID: 90 --- !u!114 &11 MonoBehaviour: m_ObjectHideFlags: 52 @@ -259,7 +259,7 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 1 m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} - m_Name: + m_Name: GameView m_EditorClassIdentifier: m_Children: [] m_Position: @@ -268,15 +268,16 @@ MonoBehaviour: y: 0 width: 1152 height: 593 - m_MinSize: {x: 202, y: 221} - m_MaxSize: {x: 4002, y: 4021} - m_ActualView: {fileID: 16} + m_MinSize: {x: 200, y: 200} + m_MaxSize: {x: 4000, y: 4000} + m_ActualView: {fileID: 17} m_Panes: - {fileID: 16} - {fileID: 17} - {fileID: 12} - m_Selected: 0 - m_LastSelected: 1 + - {fileID: 19} + m_Selected: 1 + m_LastSelected: 0 --- !u!114 &12 MonoBehaviour: m_ObjectHideFlags: 52 @@ -360,9 +361,9 @@ MonoBehaviour: m_IsLocked: 0 m_FolderTreeState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: ea550000 - m_LastClickedID: 21994 - m_ExpandedIDs: 00000000e8550000ea55000000ca9a3b + m_SelectedIDs: 6a550000 + m_LastClickedID: 21866 + m_ExpandedIDs: 00000000685500006a55000000ca9a3b m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -378,7 +379,7 @@ MonoBehaviour: m_IsRenaming: 0 m_OriginalEventType: 11 m_IsRenamingFilename: 1 - m_ClientGUIView: {fileID: 0} + m_ClientGUIView: {fileID: 5} m_SearchString: m_CreateAssetUtility: m_EndAction: {fileID: 0} @@ -390,7 +391,7 @@ MonoBehaviour: scrollPos: {x: 0, y: 0} m_SelectedIDs: m_LastClickedID: 0 - m_ExpandedIDs: 00000000e8550000ea550000 + m_ExpandedIDs: 00000000685500006a550000 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -417,7 +418,7 @@ MonoBehaviour: m_ListAreaState: m_SelectedInstanceIDs: m_LastClickedInstanceID: 0 - m_HadKeyboardFocusLastEvent: 0 + m_HadKeyboardFocusLastEvent: 1 m_ExpandedInstanceIDs: c6230000 m_RenameOverlay: m_UserAcceptedRename: 0 @@ -434,7 +435,7 @@ MonoBehaviour: m_IsRenaming: 0 m_OriginalEventType: 11 m_IsRenamingFilename: 1 - m_ClientGUIView: {fileID: 0} + m_ClientGUIView: {fileID: 5} m_CreateAssetUtility: m_EndAction: {fileID: 0} m_InstanceID: 0 @@ -520,9 +521,9 @@ MonoBehaviour: m_SceneHierarchy: m_TreeViewState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: - m_LastClickedID: 0 - m_ExpandedIDs: 32fbffff + m_SelectedIDs: 80570000 + m_LastClickedID: 22400 + m_ExpandedIDs: bef8ffffb2f9ffff32fbffff m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -818,7 +819,7 @@ MonoBehaviour: layout: 4 m_OverlaysVisible: 1 m_WindowGUID: 87074b92afa2615c8a17e6a209bbf6a9 - m_Gizmos: 1 + m_Gizmos: 0 m_OverrideSceneCullingMask: 6917529027641081856 m_SceneIsLit: 1 m_SceneLighting: 1 @@ -827,9 +828,9 @@ MonoBehaviour: m_PlayAudio: 0 m_AudioPlay: 0 m_Position: - m_Target: {x: -0.92134225, y: -8.062253, z: 6.377667} + m_Target: {x: -0.04489796, y: 0.120189056, z: -0.034687217} speed: 2 - m_Value: {x: -0.92134225, y: -8.062253, z: 6.377667} + m_Value: {x: -0.04489796, y: 0.120189056, z: -0.034687217} m_RenderMode: 0 m_CameraMode: drawMode: 0 @@ -876,13 +877,13 @@ MonoBehaviour: m_GridAxis: 1 m_gridOpacity: 0.5 m_Rotation: - m_Target: {x: -0.43456033, y: 0.05047882, z: -0.024403224, w: -0.8988971} + m_Target: {x: 0.28117505, y: 0.4320915, z: -0.14381126, w: 0.84475166} speed: 2 - m_Value: {x: -0.43448466, y: 0.053175222, z: -0.025706764, w: -0.89874065} + m_Value: {x: 0.2811681, y: 0.43208084, z: -0.14380771, w: 0.8447308} m_Size: - m_Target: 7.586129 + m_Target: 0.4773262 speed: 2 - m_Value: 7.586129 + m_Value: 0.4773262 m_Ortho: m_Target: 0 speed: 2 @@ -927,10 +928,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 507 - y: 94 - width: 1532 - height: 790 + x: 378 + y: 81 + width: 1150 + height: 572 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -942,10 +943,10 @@ MonoBehaviour: m_ShowGizmos: 0 m_TargetDisplay: 0 m_ClearColor: {r: 0, g: 0, b: 0, a: 0} - m_TargetSize: {x: 1532, y: 769} + m_TargetSize: {x: 1150, y: 551} m_TextureFilterMode: 0 m_TextureHideFlags: 61 - m_RenderIMGUI: 0 + m_RenderIMGUI: 1 m_EnterPlayModeBehavior: 0 m_UseMipMap: 0 m_VSyncEnabled: 0 @@ -957,10 +958,10 @@ MonoBehaviour: m_VRangeLocked: 0 hZoomLockedByDefault: 0 vZoomLockedByDefault: 0 - m_HBaseRangeMin: -766 - m_HBaseRangeMax: 766 - m_VBaseRangeMin: -384.5 - m_VBaseRangeMax: 384.5 + m_HBaseRangeMin: -575 + m_HBaseRangeMax: 575 + m_VBaseRangeMin: -275.5 + m_VBaseRangeMax: 275.5 m_HAllowExceedBaseRangeMin: 1 m_HAllowExceedBaseRangeMax: 1 m_VAllowExceedBaseRangeMin: 1 @@ -978,23 +979,23 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 21 - width: 1532 - height: 769 + width: 1150 + height: 551 m_Scale: {x: 1, y: 1} - m_Translation: {x: 766, y: 384.5} + m_Translation: {x: 575, y: 275.5} m_MarginLeft: 0 m_MarginRight: 0 m_MarginTop: 0 m_MarginBottom: 0 m_LastShownAreaInsideMargins: serializedVersion: 2 - x: -766 - y: -384.5 - width: 1532 - height: 769 + x: -575 + y: -275.5 + width: 1150 + height: 551 m_MinimalGUI: 1 m_defaultScale: 1 - m_LastWindowPixelSize: {x: 1532, y: 790} + m_LastWindowPixelSize: {x: 1150, y: 572} m_ClearInEditMode: 1 m_NoCameraWarning: 1 m_LowResolutionForAspectRatios: 01000000000000000000 @@ -1020,12 +1021,42 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 8 - y: 718 - width: 1366 - height: 308 + x: 0 + y: 674 + width: 1529 + height: 365 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default m_SaveData: [] m_OverlaysVisible: 1 +--- !u!114 &19 +MonoBehaviour: + m_ObjectHideFlags: 52 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6256dd53c6120f64886f6a899d82f4d0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_MinSize: {x: 100, y: 100} + m_MaxSize: {x: 4000, y: 4000} + m_TitleContent: + m_Text: 'CCK :: Control Panel' + m_Image: {fileID: 0} + m_Tooltip: + m_Pos: + serializedVersion: 2 + x: 378 + y: 81 + width: 1150 + height: 572 + m_ViewDataDictionary: {fileID: 0} + m_OverlayCanvas: + m_LastAppliedPresetName: Default + m_SaveData: [] + m_OverlaysVisible: 1 + abiLogo: {fileID: 2800000, guid: 0d770be82f9f8c24f8ce828100c873ee, type: 3}