How to handle a parametric equation in raytracing? After taking a look at the Mobius strip, I noticed its equation is really simple and tried to add it into my Raytracer.

I tried a "naive" way by simply generating N triangles attached to each other to obtain the desired shape. While this approach works, the result it not really pretty:



(By the way I probably have an issue with my normals but I don't know where it comes from.)

I tried it with PovRay and the result was astonishing. Perfectly smooth strip made in a far far FAR smaller time than mine. I'm pretty sure Povray is well optimized but I also think it won't generate triangles like I did.



In case that might help, here is the actual code used (C++) :

float step = .1f;
float halW = 0.5f;

_facets.clear();

auto lambda = [this] (float v, float t) {
  Vec_t p;

  float cdv = Tools::Cos(2 * v);
  float sdv = Tools::Sin(2 * v);
  float ctv = Tools::Cos(v);
  float stv = Tools::Sin(v);

  float c = 2 + t * ctv;

  p.x = c * cdv;
  p.z = c * sdv;
  p.y = t * stv;

  return p;
};

for (float v = 0.f; v &lt; Globals::PI; v += step)
{
  if (v &gt; Globals::PI)
    v = Globals::PI;

  for (float t = -halW; t &lt; halW; t += step)
  {
    if (t &gt; halW)
      t = halW;

    Vec3 p1 = lambda(v, t);
    Vec3 p2 = lambda(v + step, t);
    Vec3 p3 = lambda(v, t + step);
    Vec3 p4 = lambda(v + step, t + step);
    _facets.emplace_back(p1, p2, p3);
    _facets.emplace_back(p3, p2, p4);
  }
}


TL;DR

How can I handle parametric surfaces like this one in raytracing?

Edit
After letting the above algorithm run for about 20 hours, I got a way prettier result (with 3 torsions instead of 1)
Many years ago I worked on a ray tracer that handled parametric surfaces, so this is unlikely to be state of the art, but, IIRC, I used a combination of interval arithmetic with (binary?) subdivision and Newton-Rhapson.

The interval arithmetic + subdivision constructed (conservative) bounding boxes which could be used for intersection rejection. I think I may also have used interval arithmetic on the 1st derivative to help determine when it was safe to launch into Newton-Rhapson. Typically the Newton steps converged very rapidly. 

You can also pre-dice your parametric surfaces and put them into an acceleration structure (Voxel grid/BVH) to speed up the process.

This work was based on/inspired by Daniel Toth's 1985 paper "On Ray Tracing Parametric Surfaces"