Raymarch Nut: add player hand positions; libgarbage example: add big cutter

This commit is contained in:
Crispy 2023-07-30 17:00:22 +02:00
parent 5abb65f616
commit b8d92002b1
4 changed files with 90 additions and 141 deletions

View file

@ -72,7 +72,7 @@ Material:
- _SmoothnessTextureChannel: 0 - _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1 - _SpecularHighlights: 1
- _SrcBlend: 1 - _SrcBlend: 1
- _SurfDist: 0.002 - _SurfDist: 0.001
- _UVSec: 0 - _UVSec: 0
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:

View file

@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0} m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.17883426, g: 0.22392553, b: 0.30580956, a: 1} m_IndirectSpecularColor: {r: 0.12732331, g: 0.13415194, b: 0.12107967, a: 1}
m_UseRadianceAmbientProbe: 0 m_UseRadianceAmbientProbe: 0
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
@ -353,6 +353,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 3 type: 3
objectId: 7271f6d6-1e8e-4444-8501-e33df2aad6db objectId: 7271f6d6-1e8e-4444-8501-e33df2aad6db
randomNum:
--- !u!114 &365616532 --- !u!114 &365616532
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -444,7 +445,7 @@ Transform:
m_LocalScale: {x: 5, y: 5, z: 5} m_LocalScale: {x: 5, y: 5, z: 5}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 10 m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &393448822 --- !u!1 &393448822
GameObject: GameObject:
@ -733,7 +734,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 6 m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &683266148 --- !u!114 &683266148
MonoBehaviour: MonoBehaviour:
@ -749,6 +750,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 3 type: 3
objectId: 19ac0a45-6040-4093-92d0-0499e618a878 objectId: 19ac0a45-6040-4093-92d0-0499e618a878
randomNum: 17983601
--- !u!114 &683266149 --- !u!114 &683266149
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -882,6 +884,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 3 type: 3
objectId: 267a3820-e773-4d80-aa35-8f7551bc813a objectId: 267a3820-e773-4d80-aa35-8f7551bc813a
randomNum:
--- !u!114 &772903852 --- !u!114 &772903852
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -992,7 +995,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 11 m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &779234488 --- !u!1 &779234488
GameObject: GameObject:
@ -1034,7 +1037,7 @@ Transform:
- {fileID: 393448823} - {fileID: 393448823}
- {fileID: 307897119} - {fileID: 307897119}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 5 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &779234490 --- !u!114 &779234490
MonoBehaviour: MonoBehaviour:
@ -1050,6 +1053,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 3 type: 3
objectId: d51b36f3-30c8-4e23-9277-34168a3024b4 objectId: d51b36f3-30c8-4e23-9277-34168a3024b4
randomNum:
--- !u!114 &779234491 --- !u!114 &779234491
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1177,98 +1181,6 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: RaymarcherObjectA 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 --- !u!1 &849578981
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1408,6 +1320,7 @@ GameObject:
- component: {fileID: 887058548} - component: {fileID: 887058548}
- component: {fileID: 887058547} - component: {fileID: 887058547}
- component: {fileID: 887058546} - component: {fileID: 887058546}
- component: {fileID: 887058549}
m_Layer: 0 m_Layer: 0
m_Name: Nut m_Name: Nut
m_TagString: Untagged m_TagString: Untagged
@ -1487,7 +1400,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 9 m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &887058546 --- !u!114 &887058546
MonoBehaviour: MonoBehaviour:
@ -1503,6 +1416,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 3 type: 3
objectId: b6156cfd-0daa-4e22-ace6-220b7ba376bc objectId: b6156cfd-0daa-4e22-ace6-220b7ba376bc
randomNum: 32637084
--- !u!114 &887058547 --- !u!114 &887058547
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1541,6 +1455,27 @@ MonoBehaviour:
snappingReferences: [] snappingReferences: []
autoHold: 0 autoHold: 0
ikReference: {fileID: 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 --- !u!1 &950930976
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1769,7 +1704,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 8 m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1057832715 --- !u!114 &1057832715
MonoBehaviour: MonoBehaviour:
@ -1785,6 +1720,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 3 type: 3
objectId: e84233ea-a6bb-4e2d-a550-0d201827fc90 objectId: e84233ea-a6bb-4e2d-a550-0d201827fc90
randomNum: 72864126
--- !u!114 &1057832716 --- !u!114 &1057832716
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1914,7 +1850,7 @@ Transform:
m_LocalScale: {x: 0.05, y: 0.05, z: 0.05} m_LocalScale: {x: 0.05, y: 0.05, z: 0.05}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 7 m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1450495540 --- !u!1 &1450495540
GameObject: GameObject:
@ -1953,6 +1889,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 3 type: 3
objectId: 1dc813d7-f29d-4afc-b082-a37f699f48fb objectId: 1dc813d7-f29d-4afc-b082-a37f699f48fb
randomNum:
--- !u!114 &1450495542 --- !u!114 &1450495542
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2064,7 +2001,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!135 &1450495546 --- !u!135 &1450495546
SphereCollider: SphereCollider:
@ -2217,7 +2154,7 @@ Transform:
m_LocalScale: {x: 19.2, y: 1, z: 1} m_LocalScale: {x: 19.2, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 4 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1500710831 --- !u!1 &1500710831
GameObject: GameObject:
@ -2295,13 +2232,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1500710831} m_GameObject: {fileID: 1500710831}
m_LocalRotation: {x: 0.36414537, y: 0, z: 0, w: 0.9313421} m_LocalRotation: {x: 0.30261943, y: 0, z: 0, w: 0.95311147}
m_LocalPosition: {x: 0, y: 0.67, z: -0.7} m_LocalPosition: {x: 0, y: 0.37, z: -0.8}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 42.71, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 35.23, y: 0, z: 0}
--- !u!1 &1651833084 --- !u!1 &1651833084
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2357,6 +2294,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 3 type: 3
objectId: e0ad42bf-6854-4fd0-ab9b-b81c76130077 objectId: e0ad42bf-6854-4fd0-ab9b-b81c76130077
randomNum:
--- !u!114 &1651833087 --- !u!114 &1651833087
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2448,7 +2386,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 2 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1764646627 --- !u!1 &1764646627
GameObject: GameObject:

View file

@ -27,7 +27,7 @@ Shader "CrispyPin/LibGarbageExample"
#define MAX_DIST _MaxDist #define MAX_DIST _MaxDist
#define SURF_DIST _SurfDist #define SURF_DIST _SurfDist
#define REFLECTIONS 1 #define REFLECTIONS 2
#define LIGHT_FN lighting #define LIGHT_FN lighting
#define SCENE_FN main #define SCENE_FN main
@ -64,36 +64,31 @@ Shader "CrispyPin/LibGarbageExample"
SurfacePoint main(float3 p) { SurfacePoint main(float3 p) {
Material floor = mat(floor_col(p)); Material floor = mat(floor_col(p));
p.y += 2.5; 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; 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 = mSphere(p - float3(-2, 1, -2), 0.5, mat1); d = qUnion(d, mHexPrism(p - float3(0, 1, 0), 0.5, 0.2));
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, d = qUnion(d,
qIntersect( qIntersect(
mHelix(rotY(p - float3(2, -1, 0), _Time.y), 0.5, 0.2, 0.13, helix_glossy), mHelix(rotY(p - float3(2, -1, 0), _Time.y), 0.5, 0.2, 0.13),
mBox(p - float3(2, 1, 0), 1.8, mat1), mBox(p - float3(2, 1, 0), 1.8),
0.05 0.05
) )
); );
d = qUnion(d, mCylinder(p - float3(-2, 1, 2), 0.4, 0.5, mat1)); d = qUnion(d, mCylinder(p - float3(-2, 1, 2), 0.4, 0.5));
d = qRound(d, 0.05 * sin(_Time.y)); d = qRound(d, 0.05 * sin(_Time.y));
float a = (sin(_Time.y)/2 + 0.5) * UNITY_PI; float torus_angle = (sin(_Time.y)/2 + 0.5) * UNITY_PI;
d = qUnion(d, mCappedTorus(p - float3(0, 1, 2), float2(sin(a), cos(a)), 0.4, 0.1, mat1)); d = qUnion(d, mCappedTorus(p - float3(0, 1, 2), float2(sin(torus_angle), cos(torus_angle)), 0.4, 0.1));
d = qUnion(d, d = qUnion(d,
mFromDist( mFromDist(
@ -101,13 +96,15 @@ Shader "CrispyPin/LibGarbageExample"
qRound(sdBox(p - float3(2, 1, 2), 1), 0.005), qRound(sdBox(p - float3(2, 1, 2), 1), 0.005),
sdGyroid(p, 12, sin(_Time.y) * UNITY_PI * 0.5, 0.2), sdGyroid(p, 12, sin(_Time.y) * UNITY_PI * 0.5, 0.2),
0.01 0.01
), )
helix_glossy
) )
); );
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.mat = mat1;
d = qUnion(d, d = qUnion(d,
qIntersect( qIntersect(
mPlaneY(p, 0, floor), mPlaneY(p, 0, floor),

View file

@ -19,6 +19,10 @@ Shader "CrispyPin/Nut"
#pragma vertex vert #pragma vertex vert
#pragma fragment frag #pragma fragment frag
#define PLAYER_COUNT 6
float4 _PlayerRightHandPositions[PLAYER_COUNT];
float4 _PlayerLeftHandPositions[PLAYER_COUNT];
int _MaxSteps; int _MaxSteps;
float _MaxDist; float _MaxDist;
float _SurfDist; float _SurfDist;
@ -36,7 +40,7 @@ Shader "CrispyPin/Nut"
// #define DISTANCE_FN separate_dist // #define DISTANCE_FN separate_dist
// #define STEP_MULTIPLIER 0.1 // #define STEP_MULTIPLIER 0.1
#define SCENE_SCALE 0.8 #define SCENE_SCALE 0.7
// #define DISABLE_DEPTH // #define DISABLE_DEPTH
// #define DISCARD_ON_MISS // #define DISCARD_ON_MISS
@ -106,12 +110,29 @@ Shader "CrispyPin/Nut"
d = qUnion(d, bolt); d = qUnion(d, bolt);
// d = qUnion(d, mSphere(p - float3(0,0,.3), 0.15, mat(1,0,0.5)), 0.1);
// floor // floor
// d = qUnion(d, mPlaneY(p, -0.5, mat(floor_col, 0)), 0.01); // 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 = 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))); 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)); // d = qUnion(d, mSphere(p - float3(0, -0.5, 1), 0.4));
return d; return d;
} }
@ -137,18 +158,11 @@ Shader "CrispyPin/Nut"
return col * (lSky(float3(0,1,0)) + lSun(float3(0,1,0), sun_dir)); return col * (lSky(float3(0,1,0)) + lSun(float3(0,1,0), sun_dir));
} }
} }
float3 col = 0; float3 light = lSun(ray.normal, sun_dir)
col = * lShadow(ray.hit_pos + ray.normal * SURF_DIST, sun_dir, 50)
// ray.mat.col * + lSky(ray.normal);
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 col*ray.mat.col; return light * ray.mat.col;
} }