Skip to content

CIS565-Fall-2015/Project5-GLSL-Ray-Marcher

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date
Oct 20, 2015
Oct 12, 2015
Oct 20, 2015
Oct 20, 2015

Repository files navigation

[CIS565 2015F] YOUR TITLE HERE

GLSL Ray Marching

University of Pennsylvania, CIS 565: GPU Programming and Architecture, Project 5

  • xinyue Zhu
  • Tested on: Chrome - Version 45.0.2454.93 m Windows 10, i5-5200U @ 2.20GHz 8.0GB, GTX 960M

Live on Shadertoy

Acknowledgements

This Shadertoy uses material from the following resources:

iq Cloudy Terrain:

https://www.shadertoy.com/view/MdlGW7

iq RayMarching Primitives:

https://www.shadertoy.com/view/Xds3zN

Numerical Methods for Ray Tracing Implicitly Defined Surfaces:

http://graphics.cs.williams.edu/courses/cs371/f14/reading/implicit.pdf

others:

http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm

### ReadMe note: to use "#define terrMap" the "#define naive" should be used at the same time

Features:

  • Two ray marching methods:
    • Naive ray marching :#define naive
    • Sphere tracing
  • different distance estimators & operation
    • Box,wheel,roundBox,plane,cone,Torus,cylinder
    • operation: subtraction,repeat
    • With normal computation
  • One simple lighting computatio: Blinn-Phong.
  • Union operator :float opU(...){}
  • Transformation operator: float opTrans(..){}
  • Lighting effects
    • Soft shadowing using secondary rays {iq-prim} {iq-rwwtt p55}
    • Ambient occlusion {iq-prim}
  • Debug views
    • Distance to surface for each pixel: #define debugView1
    • Number of ray march iterations used for each pixel: #define debugView2

  • Advanced distance estimators
    • Height-mapped terrain rendering: (texture base)

Analysis

  • Provide an analysis comparing naive ray marching with sphere tracing

    naive ray marching: 5.6fps; 132 ms

    accelated ray marching : 60.1fps; 22.5 ms

    * the "most expensive" fragments by number of iterations required for each pixel.

    the first one is using naive ray marching, the whiter the number of iteration is bigger. the shadow I calculate using

the fixed footstep, so it iterates much. The naive ray marching is much more "expensive"

  • Compare time spent ray marching vs. time spent shading/lighting:

##Branch divergence I think I have optimized my branch as much as I can. So the functions are all called onece, do not need to recalculate.

Resources

For any code/material in the 565 slides, please reference the source found at the bottom of the slide.

  • {McGuire} Morgan McGuire, Williams College. Numerical Methods for Ray Tracing Implicitly Defined Surfaces (2014). PDF
    • You may credit and use code from this reference.
  • {iq-prim} Iñigo Quílez. Raymarching Primitives (2013). Shadertoy
  • {iq-terr} Iñigo Quílez. Terrain Raymarching (2007). Article
    • You may credit and use code from this reference.
  • {iq-rwwtt} Iñigo Quílez. Rendering Worlds with Two Triangles with raytracing on the GPU (2008). Slides
  • {Ashima} Ashima Arts, Ian McEwan, Stefan Gustavson. webgl-noise. GitHub
    • You may use this code under the MIT-expat license.

About

CIS 565 Project 5: Shadertoy Ray Marcher

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages