anselm94 / raytracer-in-a-weekend-nodejs

A Ray Tracer Implementation in JS based on the book 'Ray Tracing in a Weekend' - http://www.realtimerendering.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ray Tracer In A Weekend - NodeJS

A Ray Tracer Implementation in NodeJS based on the book Ray Tracing in A Weekend by Peter Shirley.

DeltaManiac gave a challenge to try Ray Tracing In A Weekend in NodeJS, which he implemented himself in Rust-Lang in here.

Cover Image

Run npm run cover under the cloned folder to get this beautiful cover image, rendered purely using JavaScript. It may take a while to render as it involves heavy computation. This image took 46 minutes to render in a i5 6300U Mobile CPU with 16GB RAM. GPU does not affect render times, as it is a software based rendering.

Prequisites

  • Clone/Download this repository

  • Install NodeJS

  • cd into the cloned folder and run npm install to install Jimp for PNG encoding

Exercises

1. Output An Image

npm run ex1

Output An Image

2. Rays, A Simple Camera & Background

npm run ex2

Rays, A Simple Camera & Background

3. Adding A Sphere

npm run ex3

Adding A Sphere

4. Surface Normals & Multiple Objects

npm run ex4

Surface Normals & Multiple Objects

5. Surface Normals & Multiple Objects | Hitable

npm run ex5

Surface Normals & Multiple Objects | Hitable

6. Antialiasing

npm run ex6

Antialiasing

7. Diffuse Materials

npm run ex7

Diffuse Materials

8. Metal

npm run ex8

Metal

9. Metal with Roughness

npm run ex9

Metal with Roughness

10. Dielectrics

npm run ex10

Dielectrics

11. Positionable Camera

npm run ex11

Positionable Camera

12. Positionable Camera - Zoom Out

npm run ex12

Positionable Camera - Zoom Out

13. Positionable Camera - Zoom In

npm run ex13

Positionable Camera - Zoom In

14. Defocus Blur

npm run ex14

Defocus Blur

15. Cover Image

npm run ex15

Cover Image

Author

Merbin J Anselm

License

MIT License

Copyright (c) 2019 Merbin J Anselm

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

A Ray Tracer Implementation in JS based on the book 'Ray Tracing in a Weekend' - http://www.realtimerendering.com

License:MIT License


Languages

Language:JavaScript 100.0%