Skip to content

Commit

Permalink
Try tapping abs
Browse files Browse the repository at this point in the history
  • Loading branch information
utensil committed Aug 16, 2024
1 parent 0f8207b commit 7542398
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dev.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

echo "🛁 Cleaning up build and output"
rm -rf build
# rm -rf build
rm -rf output
./build.sh

Expand Down
12 changes: 9 additions & 3 deletions trees/math-000K.tree
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#define RAYMARCH_AMBIENT vec3(0.7, 0.9, 1.0)
// #define RAYMARCH_AMBIENT vec3(0.374,0.481,0.535)

#define EPSILON 0.0001

#include "lygia/space/ratio.glsl"
#include "lygia/sdf.glsl"
#include "lygia/lighting/raymarch.glsl"
Expand Down Expand Up @@ -58,11 +60,15 @@ float mySDF2(vec3 p) {
float z2 = pow(z, 2.);
float y3 = pow(y, 3.);

return 5.*(z2+y3-y4-x2*y2);
// return 5.*(z2+y3-y4-x2*y2);

// return (y2-x2-z2);

// return (x2-z2*y2+y3);
return (x2-z2*y2+y3);
}

float tapping_abs(float x) {
return max(-0.01 * x, x);
}

Material raymarchMap( in vec3 pos ) {
Expand All @@ -77,7 +83,7 @@ Material raymarchMap( in vec3 pos ) {

// res = opUnion(res, materialNew( vec3(1.0, 2.0, 1.0), opIntersection(0.05 * abs(mySDF2(pos)), cubeSDF(pos, 1.0))) );

Material res = materialNew( vec3(1.0, 2.0, 1.0), opIntersection(0.05 * abs(mySDF2(pos)), sphereSDF(pos, 1.8)));
Material res = materialNew( vec3(1.0, 2.0, 1.0), opIntersection(0.05 * tapping_abs(mySDF2(pos)), sphereSDF(pos, 1.8)));

// res = opUnion( res, materialNew( vec3(1.0, 1.0, 1.0), 1.0, 0.0, sphereSDF(pos-vec3( 0.0, 2.0, 0.0), 0.5 ) ) );
// res = opUnion( res, materialNew( vec3(0.0, 1.0, 1.0), boxSDF( pos-vec3( 2.0, 0.5, 0.0), vec3(0.4, 0.4, 0.4) ) ) );
Expand Down

0 comments on commit 7542398

Please sign in to comment.