Published
Edited
Dec 17, 2020
1 fork
1 star
Insert cell
Insert cell
Insert cell
sh = () => raymarch({
// eye: `vec3(cos(u_time * TAU) * 3.5, 1.5, sin(u_time * TAU) * 3.5)`,
sceneSDF: `
${opSmoothUnion()}
${opUnion()}
${rotate3D()}
${sdBox()}
${sdSphere()}
${hg_sdf()}
${opBlend()}
${easeInOutQuad()}

float glow = 0.;
vec2 sceneSDF(vec3 p) {
//p *= rotate3D(u_time * TAU, vec3(0, 1, 0));
float d = 1e10;
const float N = 20.;
for(float i = 0.; i < N; i ++) {
float angle = TAU / N * i;
vec3 q = vec3(cos(angle), 0., sin(angle)) * 1.;
q *= rotate3D(-u_time * TAU / N * 5., vec3(0, 1, 0));
d = opUnion(d, sdBox(p + q, vec3(vec2(.0001, 800.).xyx)));
}
glow += 0.01 / (0.01 + d * d * 50.) / (float(AA) * 4.);

initGDFVectors();
p *= rotate3D(easeInOutQuad(fract(u_time * 2. + .5)) * TAU, vec3(1, 1, 0));
d = opUnion(d, opBlend(fTruncatedOctahedron(p, 1.3), fIcosahedron(p, 1.3), sin(u_time * TAU) * .5 + .5));

return vec2(d, 60.);
}
`,
effect: `
vec3 effect(vec3 c) {
c += glow * vec3(1., 0.3, 0.3);
return c;
}`,
antiAliasing: 3,
logShader: true
})
Insert cell
Insert cell
import {raymarch, computeColorIQ} from '@makio135/raymarch'
Insert cell
import {bnbShader} from '@makio135/bnbshader'
Insert cell
import {sdBox, sdSphere, opSmoothUnion, opUnion, opBlend} from '@makio135/iq-sdf'
Insert cell
import {rotate3D, hg_sdf} from '@makio135/glsl-snippets'
Insert cell
import {easeInOutQuad} from '@makio135/motion-toolkit'
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more