|
2305 | 2305 | ---------------------------------- |
2306 | 2306 | There's one potential problem lurking here. Notice that the `ray_color` function is recursive. When |
2307 | 2307 | will it stop recursing? When it fails to hit anything. In some cases, however, that may be a long |
2308 | | -time — long enough to blow the stack. To guard against that, let's limit the maximum recursion |
| 2308 | +time -- long enough to blow the stack. To guard against that, let's limit the maximum recursion |
2309 | 2309 | depth, returning no light contribution at the maximum depth: |
2310 | 2310 |
|
2311 | 2311 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
|
4076 | 4076 | ----------- |
4077 | 4077 | You now have a cool ray tracer! What next? |
4078 | 4078 |
|
4079 | | - 1. Lights -- You can do this explicitly, by sending shadow rays to lights, or it can be done |
4080 | | - implicitly by making some objects emit light, biasing scattered rays toward them, and then |
4081 | | - downweighting those rays to cancel out the bias. Both work. I am in the minority in favoring |
4082 | | - the latter approach. |
4083 | 4079 |
|
4084 | | - 2. Triangles -- Most cool models are in triangle form. The model I/O is the worst and almost |
4085 | | - everybody tries to get somebody else’s code to do this. |
| 4080 | +### Book 2: _Ray Tracing: The Next Week_ |
| 4081 | +The second book in this series builds on the ray tracer you've developed here. This includes new |
| 4082 | +features such as: |
4086 | 4083 |
|
4087 | | - 3. Surface Textures -- This lets you paste images on like wall paper. Pretty easy and a good thing |
4088 | | - to do. |
| 4084 | + - Motion blur -- Realistially render moving objects. |
| 4085 | + - Bounding volume hierarchies -- speeding up the rendering of complex scenes. |
| 4086 | + - Texture maps -- placing images on objects. |
| 4087 | + - Perlin noise -- a random noise generator very useful for many techniques. |
| 4088 | + - Quadrilaterals -- something to render besides spheres! Also, the foundation to implement disks, |
| 4089 | + triangles, rings or just about any other 2D primitive. |
| 4090 | + - Lights -- add sources of light to your scene. |
| 4091 | + - Transforms -- useful for placing and rotating objects. |
| 4092 | + - Volumetric rendering -- render smoke, clouds and other gaseous volumes. |
4089 | 4093 |
|
4090 | | - 4. Solid textures -- Ken Perlin has his code online. Andrew Kensler has some very cool info at his |
4091 | | - blog. |
4092 | 4094 |
|
4093 | | - 5. Volumes and Media -- Cool stuff and will challenge your software architecture. I favor making |
4094 | | - volumes have the hittable interface and probabilistically have intersections based on density. |
4095 | | - Your rendering code doesn’t even have to know it has volumes with that method. |
| 4095 | +### Book 3: _Ray Tracing: The Rest of Your Life_ |
| 4096 | +This book expands again on the content from the second book. A lot of this book is about improving |
| 4097 | +both the rendered image quality and the renderer performance, and focuses on generating the _right_ |
| 4098 | +rays and accumulating them appropriately. |
4096 | 4099 |
|
4097 | | - 6. Parallelism -- Run $N$ copies of your code on $N$ cores with different random seeds. Average |
4098 | | - the $N$ runs. This averaging can also be done hierarchically where $N/2$ pairs can be averaged |
4099 | | - to get $N/4$ images, and pairs of those can be averaged. That method of parallelism should |
4100 | | - extend well into the thousands of cores with very little coding. |
| 4100 | +This book is for the reader seriously interested in writing professional-level ray tracers, and/or |
| 4101 | +interested in the foundation to implement advanced effects like subsurface scattering or nested |
| 4102 | +dielectrics. |
| 4103 | + |
| 4104 | + |
| 4105 | +### Other Directions |
| 4106 | +There are so many additional directions you can take from here, including techniques we haven't |
| 4107 | +(yet?) covered in this series. These include: |
| 4108 | + |
| 4109 | +**Triangles** -- Most cool models are in triangle form. The model I/O is the worst and almost |
| 4110 | +everybody tries to get somebody else’s code to do this. This also includes efficiently handling |
| 4111 | +large _meshes_ of triangles, which present their own challenges. |
| 4112 | + |
| 4113 | +**Parallelism** -- Run $N$ copies of your code on $N$ cores with different random seeds. Average the |
| 4114 | +$N$ runs. This averaging can also be done hierarchically where $N/2$ pairs can be averaged to get |
| 4115 | +$N/4$ images, and pairs of those can be averaged. That method of parallelism should extend well into |
| 4116 | +the thousands of cores with very little coding. |
| 4117 | + |
| 4118 | +**Shadow Rays** -- When firing rays at light sources, you can determine exactly how a particular point |
| 4119 | +is shadowed. With this, you can render crisp or soft shadows, adding another degreee of realism to |
| 4120 | +your scenes. |
4101 | 4121 |
|
4102 | 4122 | Have fun, and please send me your cool images! |
4103 | 4123 |
|
|
0 commit comments