https://github.com/lorransutter/raycasting-p5
Ray casting implementation using p5js
https://github.com/lorransutter/raycasting-p5
collision-detection p5js raycasting
Last synced: 2 months ago
JSON representation
Ray casting implementation using p5js
- Host: GitHub
- URL: https://github.com/lorransutter/raycasting-p5
- Owner: LorranSutter
- Created: 2020-05-03T22:58:35.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-06-13T18:23:11.000Z (almost 5 years ago)
- Last Synced: 2025-01-01T05:30:01.657Z (4 months ago)
- Topics: collision-detection, p5js, raycasting
- Language: JavaScript
- Size: 14.1 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Raycasting-p5
Ray casting with reflections implementation using p5js inspired by [Daniel Shiffman](https://github.com/shiffman)---

## :runner: How to run
Just open index.html file in browser.
## :bulb: What is Ray Casting?
Ray casting is a famous approach that aims to detect intersections between casted rays and surfaces. It is used to solve problems in Computer Graphics and Computational Geometry. An well known problem, named [Ray Tracing](https://en.wikipedia.org/wiki/Ray_tracing_(graphics)), employs ray casting to generate images by tracing the light path in a scene. Also it is possible to provide more sophisticated images using physical phenomena such as reflection and refraction.
In this code, ray casting was implemented and extendend using simple reflection. As it is possible to see in the equation and image below, it aims to define the reflected ray (R) from the incident ray (I) through the normal of the surface (N).
\vec{N})
## :book: Resources
- [The Coding Train - 2D Raycasting](https://www.youtube.com/watch?v=TOEi6T2mtHo) - video of 2D raycasting implementation
- [Reflection](https://www.scratchapixel.com/lessons/3d-basic-rendering/introduction-to-shading/reflection-refraction-fresnel) - understanding reflection## :computer: Technologies
- [P5js](https://p5js.org/) - drawing library## :cookie: Credits
- [Daniel Shiffman](https://github.com/shiffman) - provider of The Coding Train