Home > Back-end >  Is it Possible to Build a Ray Tracer for an Arbitary Shape?
Is it Possible to Build a Ray Tracer for an Arbitary Shape?

Time:10-24

Yesterday, I started looking into ray-tracing, and it seems that there are many algorithms for redering spheres and other common shapes. However, I want to be able to render an arbitrary 3D shape defined by an arbitrary multivariate function.

The problem seems to be in the ray intersection algorithm: if the equation of a shape is known, then the equation to solve for the intersection points of the shape and the ray can in a sense be "pre-computed" and then solved for at run time. If the equation of the shape is not known at compile-time, then the equation to solve for the intersections will have to be constructed at run-time. Thus, it appears that a symbolic algebra system must be in place for this to actually work, which seems a little overkill.

I know that I can just find the polygonal representation of the shape, but I don't want to do this; at that point I might as well do rasterization instead of ray-tracing. Is it at all possible to do ray-tracing with arbitary multivariate functions?

This question may be trivial, but I haven't found too much when researching this question, nor do I know enough about ray tracing yet to answer my own question. Thank you to all that answer.

CodePudding user response:

I've heard talks about how images like https://www.imaginary.org/gallery/herwig-hauser-classic or https://www.imaginary.org/gallery/oliver-labs would get rendered.

When shooting a ray the multivariate polynomial becomes univariate, parameterized along the direction of the ray. Now you would be looking for a root of this polynomial, more specifically the root with the smallest positive real parameter, corresponding to the first intersection in front of the camera. Sturm sequences were playing a role in that, if I recall correctly. Once the root has been found, the gradient of the multivariate polynomial will indicate the normal direction so you can do lighting based on that.

I don't know whether any general purpose ray tracing software would handle algebraic varieties like this. There is some specialized software out there. The one used for the images referenced above was called SURFER. There also was a GPU-based version I heard describes in a talk. I'm not quite sure whether they would be doing full ray tracing or just ray casting.

  • Related