Re:Raytracing in One Weekend (2016)
by dahart on Monday November 30, 2020 @11:00PM
(#25262161)
I think of it not exactly, but sort-of, the other way around: using trig without any linear algebra is a shortcut to doing the linear algebra. Or maybe it’s just that the trig stays the same, but it’s possible to hard-code or short-cut your transforms to not include matrices or dot products explicitly... in simple cases. In reality trig and LA aren’t in competition, they’re both necessary in a serious renderer, and they represent different tools and different views on vectors.
Sines and cosines fall out of rotations because of the implicit circle involved, but it’s more general to think of a transform between two basis frames. It just so happens that the lengths of basis vectors of one frame projected to the other are computed using sines and cosines, but the transform and dot products are there whether they’re made explicit or not.
Using only sines and cosines falls apart very quickly, here are a couple of examples:
Compute a surface normal under non-uniform scaling. You need the inverse transpose matrix. I don’t even know how to derive it using trig.
Implement instancing or a character rig in your ray tracer. As soon as you need to compose transforms just to trace a ray, the trig route is off the table (impractical in the extreme), and matrix math is required. An alternative might be geometric algebra - is that in the same boat with linear algebra for you?
Sines and cosines fall out of rotations because of the implicit circle involved, but it’s more general to think of a transform between two basis frames. It just so happens that the lengths of basis vectors of one frame projected to the other are computed using sines and cosines, but the transform and dot products are there whether they’re made explicit or not.
Using only sines and cosines falls apart very quickly, here are a couple of examples:
Compute a surface normal under non-uniform scaling. You need the inverse transpose matrix. I don’t even know how to derive it using trig.
Implement instancing or a character rig in your ray tracer. As soon as you need to compose transforms just to trace a ray, the trig route is off the table (impractical in the extreme), and matrix math is required. An alternative might be geometric algebra - is that in the same boat with linear algebra for you?