

GitHub - kapsy/swift_ray_tracer: A simple path tracer programmed in Swift
source link: https://github.com/kapsy/swift_ray_tracer
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md
About
This program was made to accompany Graphics like Pixar using Swift, a lightning talk given at try! Swift Tokyo in 2019.
This is a simple ray tracer, or more specifically, path tracer, built using Swift.
Much of the code is derived from Pete Shirley's Ray Tracing Minibooks, with a few added extras.
Overview
For each pixel, ns
rays are stochastically fired into a simple scene.
The final pixel color is just the average color of each ray, which is calculated using the material properties of whatever sphere the ray happens to intersect with.
To make things interesting, a simple looping camera animation was adding using Rodrigues rotation. Single frames are output as ppm
files, and converted to an mp4
using ffmpeg
after the program has run.
Algorithms
- Line sphere intersection
- Path tracing
- Lamberian scattering
- Fresnel equations
- Schlick approximation
- Perlin noise
- Rodrigues rotation formula
Requirements
- Xcode 10
- Swift 4.2
- ffmpeg
Installation
Run build.sh
and everything should just work!
Performance
The default render settings are quite slow. The whole program is single threaded, and not optimized at all.
To reduce the rendering time, try the following:
- Reducing the output image resolution.
- Reduce the number of rays per pixel.
- Reduce the frames drawn, either the duration of the animation or framerate.
Recommend
-
56
DX7-Supercollider My accurate Yamaha DX-7 clone. Programmed in Supercollider. This is a super-exact clone of DX7 in SC environment. This project began with my internship at the STEIM during the last year; I was able to get my han...
-
50
Command-line utility for Tangling of Org documents — programmed in Nim. - OrgTangle/ntangle
-
22
OCaPIC: Programming PIC microcontrollers in OCaml This project allows to run OCaml programs on PIC microcontrollers. Meeting of two worlds ...
-
41
r/java: News, Technical discussions, research papers and assorted things of interest related to the Java programming languageNO programming help, NO learning Java related questions!
-
8
Thermodynamic control of −1 programmed ribosomal frameshiftingIntroductionRibosome frameshifting is a recoding event that causes ribosome slippage along the mRNA and changes the sequence of the synthesized protein. Frameshi...
-
10
Files Permalink Latest commit message Commit time
-
5
How to delete user data in Android programmed? advertisements Hello i am new in android , i followed a
-
9
-
5
The Quote Bot A Twitter Bot Programmed in python, Deployed with Heroku. Gives you a movie quote. Find me at @The_QuoteBot "This is Mr. Oh, your friendly Twitter Quote...
-
11
a zig sdl android app template This is a tutorial that will guide you how to build an Android application 'by hand' using Zig as the main programming language SDL as the platform abstraction zig bu...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK