
2D Raytracing
< First thing I would like to say is that thank you all, I have hade a massive influx of followers and I thank you all for it. But anyway time to get to my approach of raytracing in scratch. First I would like to talk about what is a raytracer. A raytracer is a computer code that send out rays into an environment and let them bounce to see how light would act in that environment. This fundamental code makes all sorts of things such as cg in big budget Hollywood movies to just little side projects for indie devs. The way that I made my version of a raytracing engine is first to find the math for the rays. There are 2 inputs, the amount of rays and the FOV. The raycaster sprite turns half of the FOV and repeats the amount of rays turning the opposite direction the FOV divided by amount of rays. each of those iterations make a new ray. My engine is a 2d raytracer meaning that it has a 2d texture that it bounces it's light in. The way that each ray works is that when it is initialized it m
Continue reading on Dev.to
Opens in a new tab




