diff --git a/Assets/raymarched/Nut.mat b/Assets/raymarched/Nut.mat index 10ff26e..cd24932 100644 --- a/Assets/raymarched/Nut.mat +++ b/Assets/raymarched/Nut.mat @@ -72,7 +72,7 @@ Material: - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - _SrcBlend: 1 - - _SurfDist: 0.001 + - _SurfDist: 0.002 - _UVSec: 0 - _ZWrite: 1 m_Colors: diff --git a/Assets/raymarched/Raymarching.unity b/Assets/raymarched/Raymarching.unity index 3682034..da0c86e 100644 --- a/Assets/raymarched/Raymarching.unity +++ b/Assets/raymarched/Raymarching.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.12732331, g: 0.13415194, b: 0.12107967, a: 1} + m_IndirectSpecularColor: {r: 0.17883426, g: 0.22392553, b: 0.30580956, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -353,7 +353,6 @@ MonoBehaviour: m_EditorClassIdentifier: type: 3 objectId: 7271f6d6-1e8e-4444-8501-e33df2aad6db - randomNum: --- !u!114 &365616532 MonoBehaviour: m_ObjectHideFlags: 0 @@ -445,7 +444,7 @@ Transform: m_LocalScale: {x: 5, y: 5, z: 5} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 9 + m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &393448822 GameObject: @@ -734,7 +733,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &683266148 MonoBehaviour: @@ -750,7 +749,6 @@ MonoBehaviour: m_EditorClassIdentifier: type: 3 objectId: 19ac0a45-6040-4093-92d0-0499e618a878 - randomNum: 17983601 --- !u!114 &683266149 MonoBehaviour: m_ObjectHideFlags: 0 @@ -884,7 +882,6 @@ MonoBehaviour: m_EditorClassIdentifier: type: 3 objectId: 267a3820-e773-4d80-aa35-8f7551bc813a - randomNum: --- !u!114 &772903852 MonoBehaviour: m_ObjectHideFlags: 0 @@ -995,7 +992,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 10 + m_RootOrder: 11 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &779234488 GameObject: @@ -1037,7 +1034,7 @@ Transform: - {fileID: 393448823} - {fileID: 307897119} m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &779234490 MonoBehaviour: @@ -1053,7 +1050,6 @@ MonoBehaviour: m_EditorClassIdentifier: type: 3 objectId: d51b36f3-30c8-4e23-9277-34168a3024b4 - randomNum: --- !u!114 &779234491 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1181,6 +1177,98 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: type: RaymarcherObjectA +--- !u!1 &845829380 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 845829382} + - component: {fileID: 845829381} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &845829381 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 845829380} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &845829382 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 845829380} + m_LocalRotation: {x: 0.85522455, y: -0.12030997, z: 0.22915669, w: 0.44900298} + m_LocalPosition: {x: 0.16, y: 3, z: 0.09} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 124.6, y: -30, z: 0} --- !u!1 &849578981 GameObject: m_ObjectHideFlags: 0 @@ -1320,7 +1408,6 @@ GameObject: - component: {fileID: 887058548} - component: {fileID: 887058547} - component: {fileID: 887058546} - - component: {fileID: 887058549} m_Layer: 0 m_Name: Nut m_TagString: Untagged @@ -1400,7 +1487,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 8 + m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &887058546 MonoBehaviour: @@ -1416,7 +1503,6 @@ MonoBehaviour: m_EditorClassIdentifier: type: 3 objectId: b6156cfd-0daa-4e22-ace6-220b7ba376bc - randomNum: 32637084 --- !u!114 &887058547 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1455,27 +1541,6 @@ MonoBehaviour: snappingReferences: [] autoHold: 0 ikReference: {fileID: 0} ---- !u!114 &887058549 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 887058541} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5256473d683a24743ab8a6b352997437, type: 3} - m_Name: - m_EditorClassIdentifier: - targetMaterial: {fileID: 2100000, guid: c881d33e96e5ee113a7ca92a93839d15, type: 2} - playerRootPositions: _PlayerRootPositions - playerHipPositions: _PlayerHipPositions - playerHeadPositions: _PlayerHeadPositions - playerLeftHandPositions: _PlayerLeftHandPositions - playerRightHandPositions: _PlayerRightHandPositions - playerChestPositions: _PlayerChestPositions - playerLeftFootPositions: _PlayerLeftFootPositions - playerRightFootPositions: _PlayerRightFootPositions --- !u!1 &950930976 GameObject: m_ObjectHideFlags: 0 @@ -1704,7 +1769,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 7 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1057832715 MonoBehaviour: @@ -1720,7 +1785,6 @@ MonoBehaviour: m_EditorClassIdentifier: type: 3 objectId: e84233ea-a6bb-4e2d-a550-0d201827fc90 - randomNum: 72864126 --- !u!114 &1057832716 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1850,7 +1914,7 @@ Transform: m_LocalScale: {x: 0.05, y: 0.05, z: 0.05} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 6 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1450495540 GameObject: @@ -1889,7 +1953,6 @@ MonoBehaviour: m_EditorClassIdentifier: type: 3 objectId: 1dc813d7-f29d-4afc-b082-a37f699f48fb - randomNum: --- !u!114 &1450495542 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2001,7 +2064,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!135 &1450495546 SphereCollider: @@ -2154,7 +2217,7 @@ Transform: m_LocalScale: {x: 19.2, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1500710831 GameObject: @@ -2232,13 +2295,13 @@ Transform: m_PrefabInstance: {fileID: 0} 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.37, z: -0.8} + m_LocalRotation: {x: 0.36414537, y: 0, z: 0, w: 0.9313421} + m_LocalPosition: {x: 0, y: 0.67, z: -0.7} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 35.23, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 42.71, y: 0, z: 0} --- !u!1 &1651833084 GameObject: m_ObjectHideFlags: 0 @@ -2294,7 +2357,6 @@ MonoBehaviour: m_EditorClassIdentifier: type: 3 objectId: e0ad42bf-6854-4fd0-ab9b-b81c76130077 - randomNum: --- !u!114 &1651833087 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2386,7 +2448,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1764646627 GameObject: diff --git a/Assets/raymarched/lib/libgarbage.cginc b/Assets/raymarched/lib/libgarbage.cginc index a12d038..ad23504 100644 --- a/Assets/raymarched/lib/libgarbage.cginc +++ b/Assets/raymarched/lib/libgarbage.cginc @@ -285,13 +285,12 @@ SurfacePoint default_material_sdf(float3 p) { } float3 default_lighting(Ray ray) { - float3 sun_dir = normalize(float3(1, 0.5, -0.5)); + float3 sun_dir = normalize(float3(1, 0.5, 0)); 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); - return light * ray.mat.col; + return 0.1; + float3 col = 0; + col = ray.mat.col * dot(ray.normal, sun_dir); + return col; } #endif // LIBGARBAGE_INCLUDED diff --git a/Assets/raymarched/lib/libgarbage_example.shader b/Assets/raymarched/lib/libgarbage_example.shader index 583b24a..730f76c 100644 --- a/Assets/raymarched/lib/libgarbage_example.shader +++ b/Assets/raymarched/lib/libgarbage_example.shader @@ -27,7 +27,7 @@ Shader "CrispyPin/LibGarbageExample" #define MAX_DIST _MaxDist #define SURF_DIST _SurfDist - #define REFLECTIONS 2 + #define REFLECTIONS 3 #define LIGHT_FN lighting #define SCENE_FN main @@ -39,8 +39,8 @@ Shader "CrispyPin/LibGarbageExample" // #define DISABLE_DEPTH // #define DISCARD_ON_MISS // #define USE_WORLD_SPACE - // #define STEP_MULTIPLIER 0.8 - #define SCENE_SCALE 0.17 + #define STEP_MULTIPLIER 0.8 + #define SCENE_SCALE 0.2 #define LIMIT_DEPTH_TO_MESH #include "libgarbage.cginc" @@ -52,10 +52,6 @@ Shader "CrispyPin/LibGarbageExample" } float3 floor_col(float3 p) { - p = rotY(p, sin(length(p.xz) * 0.2) * 0.2); - float atime = fmod(_Time.y * 0.3, 1); - p.x += smoothstep(0, 0.5, atime) * 2; - p.z += smoothstep(0.5, 1, atime) * 2; return lerp(0.08, checkers(p - 1, 0.06, 0.12, 2), smoothstep(64, 0, length(p)) @@ -64,53 +60,30 @@ Shader "CrispyPin/LibGarbageExample" SurfacePoint main(float3 p) { Material floor = mat(floor_col(p)); + p.y += 2.5; + // Material green = mat(float3(0.05, 0.8, 0.2)); + Material mat1 = mat(1, 0.3, 0.1); + // Material mat1 = mat(0.05); + Material helix_glossy = mat(float3(1, 0.2, 0.05), 0.5); + SurfacePoint d; - d = mSphere(p - float3(-2, 1, -2), 0.5); - d = qUnion(d, mTorus(p - float3(0, 1, -2), 0.4, 0.1)); - // float3 line_a = float3(1.5, 1.5, -2); - float3 line_a = float3(2 - cos(_Time.z)*0.5, 1.5, -2 - sin(_Time.z)*0.5); - float3 line_b = float3(2 + cos(_Time.z)*0.3, 0.5, -2 + sin(_Time.z)*0.3); - d = qUnion(d, mLine(p, line_a, line_b, 0.2)); - d = qUnion(d, mBox(p - float3(-2, 1, 0), float3(0.5, 0.5, 0.8))); - d = qUnion(d, mHexPrism(p - float3(0, 1, 0), 0.5, 0.2)); - d = qUnion(d, - qIntersect( - mHelix(rotY(p - float3(2, -1, 0), _Time.y), 0.5, 0.2, 0.13), - mBox(p - float3(2, 1, 0), 1.8), - 0.05 - ) - ); - d = qUnion(d, mCylinder(p - float3(-2, 1, 2), 0.4, 0.5)); + d =/* qUnion(d, */ mSphere(p - float3(-2, 1, -2), 0.5, mat1)/* ) */; + d = qUnion(d, mTorus(p - float3(0, 1, -2), 0.4, 0.1, mat1)); + d = qUnion(d, mLine(p, float3(1.5, 1.5, -2), float3(2.5, 0.5, -2), 0.2, mat1)); + + d = qUnion(d, mBox(p - float3(-2, 1, 0), float3(0.5, 0.5, 0.8), mat1)); + d = qUnion(d, mHexPrism(p - float3(0, 1, 0), 0.5, 0.2, mat1)); + d = qUnion(d, qIntersect(mHelix(rotY(p - float3(2, -1, 0), _Time.y), 0.5, 0.2, 0.13, helix_glossy), mBox(p - float3(2, 1, 0), 1.8, mat1),0.05)); + + d = qUnion(d, mCylinder(p - float3(-2, 1, 2), 0.4, 0.5, mat1)); d = qRound(d, 0.05 * sin(_Time.y)); - - float torus_angle = (sin(_Time.y)/2 + 0.5) * UNITY_PI; - d = qUnion(d, mCappedTorus(p - float3(0, 1, 2), float2(sin(torus_angle), cos(torus_angle)), 0.4, 0.1)); - - d = qUnion(d, - mFromDist( - qIntersect( - qRound(sdBox(p - float3(2, 1, 2), 1), 0.005), - sdGyroid(p, 12, sin(_Time.y) * UNITY_PI * 0.5, 0.2), - 0.01 - ) - ) - ); - - d.mat = mat(float3(0.1, 0.6, 1.0), 0.5); - float3 p2 = p - float3(0, 2, sin(_Time.x * 5) * 3); - d = qUnion(d, qRound(mBox(p2, float3(6, 4, .2), mat(0.1)), 0.01)); - d = qSub(d, mBox(p2, float3(5.6, 3.6, .25)), 0.02); - - d = qUnion(d, - qIntersect( - mPlaneY(p, 0, floor), - mSphere(p, 7, floor) - ) // limit floor size for better performance - ); + // d.mat = mat1; + d = qUnion(d, mPlaneY(p, 0, floor)); + d = qIntersect(d, mSphere(p, 7, d.mat)); // limit floor size for better performance return d; } @@ -119,7 +92,8 @@ Shader "CrispyPin/LibGarbageExample" if (ray.missed) { if (ray.dir.y >= 0) { return lRenderSky(ray.dir, sun_dir); - } else { + } else + { float3 cam = ray.start; cam.y += 2.5; float3 dir = ray.dir; diff --git a/Assets/raymarched/lib/libgarbage_lighting.cginc b/Assets/raymarched/lib/libgarbage_lighting.cginc index 1ad8561..024ffd3 100644 --- a/Assets/raymarched/lib/libgarbage_lighting.cginc +++ b/Assets/raymarched/lib/libgarbage_lighting.cginc @@ -3,17 +3,18 @@ // common lighting operations // -------------------------------- -float3 lRenderSun(float3 ray_dir, float3 sun_dir, float3 sun_col = float3(0.8, 0.4, 0.1)) { +float3 lRenderSun(float3 ray_dir, float3 sun_dir) { float alignment = min(acos(dot(ray_dir, sun_dir)), 1); - float sun_amount = pow(0.025/alignment, 3); - return sun_amount * sun_col; + float sun_amount = smax(min(0.03 / alignment, 5) - 0.06, 0, 0.15); + return sun_amount* float3(0.8, 0.4, 0.1); } // a basic procedural sky float3 lRenderSky(float3 ray_dir, float3 sun_dir) { float3 rendered_sun = lRenderSun(ray_dir, sun_dir); - float a = 1 - abs(ray_dir.y); - return lerp(float3(0.3, 0.3, 0.7), float3(0.6, 0.7, 0.9), a) + rendered_sun; + // float3 rendered_sun = max(0, pow(dot(ray_dir, sun_dir) + 0.4, 10)-28) * float3(0.8, 0.4, 0); + return float3(0.7, 0.75, 0.8) - abs(ray_dir.y) * 0.5 + rendered_sun; + // return rendered_sun; } //calculate sky light diff --git a/Assets/raymarched/lib/libgarbage_shapes.cginc b/Assets/raymarched/lib/libgarbage_shapes.cginc index fd03190..f341934 100644 --- a/Assets/raymarched/lib/libgarbage_shapes.cginc +++ b/Assets/raymarched/lib/libgarbage_shapes.cginc @@ -44,13 +44,6 @@ float sdTorus(float3 p, float radius, float thickness) { } _MAT_VARIANT2(mTorus, sdTorus, float, radius, float, thickness) -float sdCappedTorus(float3 p, float2 sc, float r1, float r2) { - p.x = abs(p.x); - float k = (sc.y * p.x > sc.x * p.z) ? dot(p.xz, sc) : length(p.xz); - return sqrt(dot(p, p) + r1 * r1 - 2.0 * r1 * k) - r2; -} -_MAT_VARIANT3(mCappedTorus, sdCappedTorus, float2, sc, float, r1, float, r2) - float sdPlaneY(float3 p, float height) { return p.y - height; } @@ -81,8 +74,7 @@ float sdHelix(float3 p, float r1, float r2, float incline) { float angle = atan2(p.z, p.x); // angle around y axis float y = angle * incline - p.y; y = fmod(y, UNITY_PI * incline * 2) + UNITY_PI * incline; - float dist = length(float2(x2, y)) - r2; - return dist * 0.8; + return length(float2(x2, y)) - r2; } _MAT_VARIANT3(mHelix, sdHelix, float, r1, float, r2, float, incline) @@ -94,14 +86,8 @@ float sdLine(float3 p, float3 a, float3 b, float r) { } _MAT_VARIANT3(mLine, sdLine, float3, a, float3, b, float3, r) -float sdGyroid(float3 p, float scale, float bias, float thickness) { - float dist = abs(dot(sin(p * scale), cos(p.zxy * scale)) + bias) - thickness; - dist *= .58 / scale; - return dist; -} -_MAT_VARIANT3(mGyroid, sdGyroid, float, scale, float, bias, float, thickness) -SurfacePoint mFromDist(float d, Material mat = DEFAULT_MAT) { +SurfacePoint mDummy(float d, Material mat = DEFAULT_MAT) { SurfacePoint o; o.dist = d; o.mat = mat; diff --git a/Assets/raymarched/nut.shader b/Assets/raymarched/nut.shader index db065dd..fcce730 100644 --- a/Assets/raymarched/nut.shader +++ b/Assets/raymarched/nut.shader @@ -19,10 +19,6 @@ Shader "CrispyPin/Nut" #pragma vertex vert #pragma fragment frag - #define PLAYER_COUNT 6 - float4 _PlayerRightHandPositions[PLAYER_COUNT]; - float4 _PlayerLeftHandPositions[PLAYER_COUNT]; - int _MaxSteps; float _MaxDist; float _SurfDist; @@ -40,7 +36,7 @@ Shader "CrispyPin/Nut" // #define DISTANCE_FN separate_dist // #define STEP_MULTIPLIER 0.1 - #define SCENE_SCALE 0.7 + #define SCENE_SCALE 0.8 // #define DISABLE_DEPTH // #define DISCARD_ON_MISS @@ -110,29 +106,12 @@ Shader "CrispyPin/Nut" d = qUnion(d, bolt); - // d = qUnion(d, mSphere(p - float3(0,0,.3), 0.15, mat(1,0,0.5)), 0.1); - // floor // d = qUnion(d, mPlaneY(p, -0.5, mat(floor_col, 0)), 0.01); // d = qIntersect(d, mPlaneY(-p, 0.6, mat(floor_col, 0)), 0.01); d = qUnion(d, mBox(p - float3(0, -0.6, 0), float3(6, 0.05, 6), mat(floor(p), 0))); - [unroll] - for (int i = 0; i < PLAYER_COUNT; i++) { - // float visible = (float)(length(_PlayerRightHandPositions[i]) > 0); - // float visible = step(0.01, length(_PlayerRightHandPositions[i])); - [flatten] - if (length(_PlayerRightHandPositions[i]) > 0.01) { - float rad = 0.1; - float3 hand_r = mul(unity_WorldToObject, float4(_PlayerRightHandPositions[i].xyz, 1)).xyz / SCENE_SCALE; - d = qUnion(d, mSphere(p - hand_r, rad, mat(0.1, sin(_Time.y)*0.5 +0.5, 1)), 0.2); - float3 hand_l = mul(unity_WorldToObject, float4(_PlayerLeftHandPositions[i].xyz, 1)).xyz / SCENE_SCALE; - d = qUnion(d, mSphere(p - hand_l, rad, mat(float3(1, 0, 0.1), 0.5)), 0.2); - } - } - - // d = qUnion(d, mSphere(p - float3(0, -0.5, 1), 0.4)); return d; } @@ -158,11 +137,18 @@ Shader "CrispyPin/Nut" return col * (lSky(float3(0,1,0)) + lSun(float3(0,1,0), sun_dir)); } } - float3 light = lSun(ray.normal, sun_dir) - * lShadow(ray.hit_pos + ray.normal * SURF_DIST, sun_dir, 50) - + lSky(ray.normal); + float3 col = 0; + col = + // ray.mat.col * + lSun(ray.normal, sun_dir); + col *= lShadow(ray.hit_pos + ray.normal * SURF_DIST, sun_dir, 50); + col += + // ray.mat.col * + lSky(ray.normal); + // float3(0.5, 0.8, 0.9); + // col = ray.mat.col; - return light * ray.mat.col; + return col*ray.mat.col; }