For example, let's say we're trying to make a bullet shine. There are two possibilities. The first is to construct a mesh of triangles that approximates the sphere and perform ray tracing. The more triangles we have, the more expensive this calculation becomes, because we have to call it that
rayTriangleIntersect () once for each triangle. However, for the special case of a sphere, there is a better way: we can use one
raySphereIntersect () Function, created by solving the equation of the ray with the equation of a sphere,
x ^ 2 + y ^ 2 + z ^ 2 = R ^ 2, This only requires one call and is thus much cheaper.
My question is: Can the same optimization be applied to different shapes? That is, there is a technique to create a surface that approaches a particular mesh so that we can implement a specialized one
rayIntersection () Function for this surface?