Content uploaded by Csaba Bálint
Author content
All content in this area was uploaded by Csaba Bálint on Mar 06, 2019
Content may be subject to copyright.
Accelerating Sphere Tracing
Csaba Bálint
Eötvös Loránd University, Budapest, Hungary
csabix@inf.elte.hu
1. Introduction
Sphere tracing is an efficient algorithm by Hart in [1] used to visualize surfaces defined implicitly
by a distance function. Keinert et al. [2] presented a faster algorithm via relaxation of the original,
and it was later used in Claybook [3] to implement a real-time simulation based computer game. We
proposed [4] a similar modification 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 A⊆R3. The mapping f:R3→R
is a distance function if f(p) = d(p,{f≡0})
for all p∈R3, where {f≡0}={p∈R3|f(p) =
0}is the represented surface.
The sphere tracing algorithm [1] shoots a ray de-
fined 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 [2] 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
instead.
4. Enhanced Step Size
Our enhanced sphere tracing algorithm [4] is based on the idea that around every p∈R3point one
can draw an unbounding sphere with radius f(p), and this is disjoint from the {f≡0}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 differs allowing for longer leaps.
The step size calculation is built upon the assumption that the approximated surface is flat which
is later relaxed to allow smooth surfaces. The figure above visualizes unbounding spheres of the two
previous ray tracing steps. The next step size and distance from the flat surface can be computed and
used as a good guess. The ω∈(0,1) parameter allows efficient 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
v∈R3ray, |v
v
v|=1, distance fn. f,
relaxation parameter ω∈(0,1)
Out: t∈[0,+∞)distance traveled on the ray
ri−1:= 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·di−ri−1+ri
di+ri−1−ri
;
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;
ri−1:= 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 flat 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-financed by the
European Social Fund (EFOP-3.6.3-VEKOP-
16-2017-00001)
8. References
[1] John C. Hart. Sphere tracing: A geometric
method for the antialiased ray tracing of im-
plicit surfaces. The Visual Computer, 12:527–
545, 1994.
[2] 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.
[3] Sebastian Aaltonen. GPU-based clay simulation
and ray-tracing tech in Claybook. San Francisco,
CA, March 2018. Game Developers Conference.
[4] Csaba Bálint and Gábor Valasek. Accelerating
Sphere Tracing. In EG 2018 - Short Papers. The
Eurographics Association, 2018.