4 ms·
I also agree. Learning a new language by building a raytracer is a lot of fun. What also helps a lot is that you can use only spheres to create a Cornell box (
by pasta 10y ago
I also agree. Learning a new language by building a raytracer is a lot of fun.
What also helps a lot is that you can use only spheres to create a Cornell box (use very large spheres for the walls). And ray-sphere intersection is 'easy'.
Then the next step is path tracing. This will help you to learn a lot about handling recursion (with or without recursion).
Other areas that you learn:
+ How scope is handled
+ (In dynamic languages) how the conversion between floats and ints work.
+ Multi threading
- K0nserv 10y agoTotally forgot about recursion. The recursive steps for reflection and refraction aren't strictly speaking path tracing are they? I honestly don't know that distinction well. Multi threading was definitely a lot easier in Rust than when I gave it a shot in my Swift version.
- pasta 10y agoI think path tracing is just a form of ray tracing. The only difference is that you continue another path at a point where the ray hits an object and collect all the light energy back to the pixel.
- K0nserv 10y agoFrom a quick Google. Path tracing doesn't trace towards light sources for shadow rays and instead just sends several rays in different directions and accumelates the resulting colors of those rays.
- pasta 10y agoI'm not sure this is true. The shadow ray pass is used to determine how much light is returned to the pixel. So something like: * shoot a ray from the pixel * when the ray hits an object check how much light that point receives * bounce the ray according to the hit material properties * repeat the bounces X times and gather how much light the pixel will receive. Because most bounes are in a random direction it's best to sample a pixel multiple times. And ofcourse more bounces give a more realistic global illumination result.
- falcolas 10y agoIt's going to depend on the material of your object. If it's perfectly reflective, you'll want to trace different rays than if it's perfectly diffuse, and if it's a rough surface (and how rough).
- alpaca128 10y agoPath tracing is just like ray tracing with randomized deviations of the rays and reflections, and this is repeated many times to reduce the noise. This can also be done with shadow rays to some extent, for soft shadows. (But it seems like every person you ask knows a different meaning for terms like raycasting, path tracing and physical based rendering)
- K0nserv 10y agoIntersecting with an infinite plane is also pretty easy so you can build a Cornell box just using planes. However the massive sphere trick is neat, never thought of that before
- maxmcorp 10y agoI wish people would learn new languages by writing new versions of winamp. That would be great.