Building Worlds With Distance Functions in GLSL (Raymarching)



Article index:


9 – Raymarching: Primitive Repetition

Build Worlds With Distance Functions in GLSL, GLSL Hacker
Raymarching: floor + rounded box repetition

Maybe one of the most mysterious distance function for me. Here is the function that repeats the rounded box:

vec2 op_rep(vec3 p, vec3 c)
{
  vec3 q = mod(p,c)-0.5*c;
  return obj_round_box(q);
}

And the distance_to_obj() function:

vec2 distance_to_obj(in vec3 p)
{
  return obj_union(obj_floor(p), op_rep(p, vec3(8.0, 8.0, 8.0)));
}

Build Worlds With Distance Functions in GLSL, GLSL Hacker
Raymarching: floor + torus repetition






References



Article index:


Pages: 1 2 3 4 5 6 7 8 9




Geeks3D.com

↑ Grab this Headline Animator