Building Worlds With Distance Functions in GLSL (Raymarching)





Article index:


5 – Raymarching: Floor + Rounded Box

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

The function to get the rounded box:

vec2 obj_round_box(vec3 p)
{
  float d = length(max(abs(p)-vec3(2.0,0.5,2.0),0.0))-0.2;
  return vec2(d,1);
}

And the distance_to_obj() function:

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






Article index:


Pages: 1 2 3 4 5 6 7 8 9




Geeks3D.com

↑ Grab this Headline Animator