The example come with this link to this article into first comment.
The example is simple but impressive.
What is interesting to see how some objects are created.
float sdPlane( const vec3 p ) {
return p.y;
}
float sdTorus( const vec3 p, const vec2 t ) {
vec2 q = vec2(length(p.xz)-t.x,p.y);
return length(q)-t.y;
}
float sdTorusYZ( const vec3 p, const vec2 t ) {
vec2 q = vec2(length(p.yz)-t.x,p.x);
return length(q)-t.y;
}
float sdTorusYX( const vec3 p, const vec2 t ) {
vec2 q = vec2(length(p.yx)-t.x,p.z);
return length(q)-t.y;
}
...