Robust CPU-based ray tracer. STAR me if you find it helpful... ⁽⁽٩(๑˃̶͈̀ ᗨ ˂̶͈́)۶⁾⁾
Water Cool
$ cd RayTracer
$ premake4 gmake
$ make
$ cd src
$ premake4 gmake
$ make
$ ./RayTracer Assets/scene.lua ## Output: scene.png
I performed photon mapping on one surface that is the ground to achieve caustics. Lights are point light and are mainly distorted by the water surface with a normal map in my scene.
Different to what is suggested in "A Practical Guide to Global Illumination using Photon Maps, Stanford", I collect nearby photons using squares instead of circles. This allows me to just use a 2D array to store a mapping for a surface. The mapping is pre-computed before shading and uses multi-threading for efficiency.
Totally 36000 photons are been casted, and the patch is a 2.5 units square. Both data is pushed to global to support concurrency.
Photon Mapping Off
Photon Mapping ON
RTX 2080ti
A Nice Looking Graphics Card
Disassemble it to Show it is Constructed by CSG
gr.construct(’name’, ’mode’) returns a ConstructiveNode and is used to perform CSG. ”mode” option is either one the three ”union”, ”difference”, and ”intersect”. ConstructiveNode only accepts two children.
For ”difference” whichever child is added first is the solid shape and the other one is the subtraction. All implementation works except ”intersect” mode.
For ”union” the surfaces inside the CSG should not exist (i.e. they will not be seen when both children are transparent)
I don’t need to perform intersect in my scene so I did not implement it. However, I know that ”intersect” is the converse of ”difference”, and I made my code modulized such that ”intersect” mode can be easily implement if needed.
Recursive reflection with maximum of 6 times
Reflection Only:
Refraction Only:
Both Reflection and Refraction:
Only supports flat surface.
Water without normal map
Water with normal map
Not implemented.
Used in both shading and photon mapping.
Take average color of 4 corners of a pixel.
Without Sumper Sampling
With Sumper Sampling
University of Waterloo Fall 2018 CS488
Constructive Solid Geometry
Peter Shirley: pg.13 10.7 Constructive Solid Geometry
Recursive Ray Tracing:
McConnell: 8.2, 8.3. Recursive Ray Tracing
Watt: 12.1. Recursive Ray Tracing
Bram de Greve, Stanford: Reflections and Refractions in Ray Tracing pg.2 - 3
Refraction:
Peter Shirley: pg.13 10.7 Refraction
Graphics Codex: Direct Illumination; Transmittion
Photon Mapping:
Course Slides: Photon Mapping
A Practical Guide to Global Illumination using Photon Maps, Stanford: pg. 14 - 18 https://graphics.stanford.edu/course00/course8.pdf