Ray marching Cities

Alice Yang
CIS 565 Final Project
Ray Marching/Sphere Tracing
Starting from eye,
proceed in small steps
along ray.
Distance Estimator
tells you how close you
are to object.
When you are close to
a certain threshold,
Coloring by number of
steps taken gives us
cheap AO with no need
for lights.
Source: http://blog.hvidtfeldts.net/index.php/2011/06/distance-estimated-3d-fractals-part-i/
The entire project is contained in a fragment
shader written in GLSL
 Code can be viewed and run on GLSL
Sandbox (http://glsl.heroku.com/e#2306.2)
 Project built off of Paulo Falcao’s basic
raymarch framework, extended to support a
number of additional features
Domain Repetition
Source: http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm /
Building Variation
Find “seed” constant for every building as
input into random float generator
 vec2 pos = vec2(ceil(p.x/c.x), ceil(p.z/c.z));
Building Geometry
Union operation: Add roofs and attics to
tops of buildings
 Subtraction operation: Windows and
wall indents
Building Geometry: Windows
Create 2D cross and
repeatedly subtract
from building bodies
 Insert inner structure
to prevent building
from looking hollow
 “free” variation from
random heights
applied afterwards
Source: http://www.iquilezles.org/www/articles/menger/menger.htm /
Mostly flat colors since project focuses
on geometry
 Half of the city samples from procedural
brick texture.
Constant values for brick and mortar
color as well as brick size and brick
 After position is calculated, every other
row is offset by half a brick’s width
 Step function: If the fract(position) is less
than brick percentage, use brick color.
Otherwise use mortar color
Live Demo

similar documents