PosterPDF Available

# Accelerating Sphere Tracing

Authors:
Accelerating Sphere Tracing
Csaba Bálint
Eötvös Loránd University, Budapest, Hungary
csabix@inf.elte.hu
1. Introduction
Sphere tracing is an eﬃcient algorithm by Hart in  used to visualize surfaces deﬁned implicitly
by a distance function. Keinert et al.  presented a faster algorithm via relaxation of the original,
and it was later used in Claybook  to implement a real-time simulation based computer game. We
proposed  a similar modiﬁcation to sphere tracing that approximates arbitrary smooth surfaces
optimally. Our measurements indicate a 50% performance increase over that of Keinert et al.
2. Sphere Tracing
Let d(p, A)denote the distance from point p
R3to surface AR3. The mapping f:R3R
is a distance function if f(p) = d(p,{f0})
for all pR3, where {f0}={pR3|f(p) =
0}is the represented surface.
The sphere tracing algorithm  shoots a ray de-
ﬁned by a pstarting position towards a v,|v|=
1direction and approximates the closest inter-
section with the fdistance function. From
the properties of f, follows that the distance
sized steps never crosses the surface, which is
a unique property to sphere tracing among im-
plicit solvers.
3. Relaxed Sphere Tracing
Relaxed sphere tracing  scales up the conser-
vative step size of sphere tracing by a factor of
1 + ω; e.g., 1.6. If the measured distance at the
new sample is too small, so when together with
the previous it does not cover the step size, the
algorithm takes the original distance sized step
4. Enhanced Step Size
Our enhanced sphere tracing algorithm  is based on the idea that around every pR3point one
can draw an unbounding sphere with radius f(p), and this is disjoint from the {f0}surface.
During the tracing algorithm, the consecutive unbounding spheres around the sample points must
intersect, so the algorithm does not skip any intersection. This test is performed in the relaxed
sphere tracing algorithm, and it is part of our enhanced sphere tracing as well. However, the step
size calculation diﬀers allowing for longer leaps.
The step size calculation is built upon the assumption that the approximated surface is ﬂat which
is later relaxed to allow smooth surfaces. The ﬁgure above visualizes unbounding spheres of the two
previous ray tracing steps. The next step size and distance from the ﬂat surface can be computed and
used as a good guess. The ω(0,1) parameter allows eﬃcient tracing of locally concave regions.
5. Enhanced Sphere Tracing
Our algorithm calculates the distep size from
two previous steps instead of just one. This
computation means step size can become ever
larger when the ray is distancing from the sur-
face while the chance the algorithm needs to step
back is low. The ω(0,1) can be used to set
the boldness of the algorithm.
In : p
p
p, v
v
vR3ray, |v
v
v|=1, distance fn. f,
relaxation parameter ω(0,1)
Out: t[0,+)distance traveled on the ray
ri1:= 0; ri:= 0; ri+1 := +;
di:= 0; t:= 0;
for i:= 0;i < imax and ri+1 not too small;
i:= i+ 1 do
di:= ri+ω·ri·diri1+ri
di+ri1ri
;
ri+1 := f(p+ (t+di)v);
if di>ri+ri+1 then
di:= ri;
ri+1 := f(p+ (t+di)v);
end
t:= t+di;
ri1:= ri;ri:= ri+1;
end
6. Results
We compared the three sphere trac-
ing variants using our GPU imple-
mentation accessible at cg.elte.hu/
~csabix/publications/EG2018/ on dif-
ferent scenes. We used a metric that
measures the time each algorithm took
to reach a given error. Even though
the construction of a single enhanced
sphere trace step is more expensive
than that of the other two sphere
tracing variants, its faster convergence
rate makes it outperform the relaxed
sphere tracing on every iteration count
up to 1.5 times.
7. Conclusions
We proposed an enhanced sphere tracing algo-
rithm that approximates smooth surfaces opti-
mally. Sphere tracing slows down near the sur-
face usually at ﬂat regions; which explains why
this step size yields better results.
Our results indicate a consistent speedup over
both algorithms, and therefore it is an excellent
candidate to replace the relaxed sphere tracing
in its applications.
Acknowledgement The project has been sup-
ported by the European Union, co-ﬁnanced by the
European Social Fund (EFOP-3.6.3-VEKOP-
16-2017-00001)
8. References
 John C. Hart. Sphere tracing: A geometric
method for the antialiased ray tracing of im-
plicit surfaces. The Visual Computer, 12:527–
545, 1994.
 Benjamin Keinert, Henry Schäfer, Johann Ko-
rndörfer, Urs Ganse, and Marc Stamminger. En-
hanced Sphere Tracing. In Smart Tools and
Apps for Graphics. The Eurographics Associa-
tion, 2014.
 Sebastian Aaltonen. GPU-based clay simulation
and ray-tracing tech in Claybook. San Francisco,
CA, March 2018. Game Developers Conference.
 Csaba Bálint and Gábor Valasek. Accelerating
Sphere Tracing. In EG 2018 - Short Papers. The
Eurographics Association, 2018.