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