2
$\begingroup$

I currently can not solve a ray-quad intersection with a quad that bends, because it is impossible to solve (because really a quad can't/shouldn't bend).

Sadly, often times, models with quadrilaterals have impossible surfaces: some quads "bend" rather than be a perfect plane/polygon. You could break the quads up into triangles, but there are two ways to do that. And even then, what do you do with the normals? Keep the quad normal onto the two resulting triangles or just recalculate the normals? What is the industry standard for this process?

$\endgroup$
  • $\begingroup$ What does the quad look like if it can't be represented geometrically? If you include why you need this, then we may be able to help you choose how best to divide the quad. For example... splitting the quad along the diagonal with the smallest/largest difference in height, splitting the quad into 4 triangles, etc. $\endgroup$ – Kyy13 Sep 30 at 16:11
  • 2
    $\begingroup$ I think the confusion here may be in the assumption that a quad has a standard surface function. A GPU will render a quad by first splitting it into 2 triangles $\endgroup$ – Kyy13 Sep 30 at 16:28
2
$\begingroup$

It sounds like you want to know how to ray trace a bilinear surface patch.

A quick search turned up this page by Ramsey, Potter & Hansen, which includes a paper and, probably better still, source code!

However, if you just want a "cheap and cheerful" hack approach, you could try replacing the quad with 4 triangles. That is, by a new vertex at the 'centre' (i.e. computing the average of the corners) and joining each edge to that new vertex. This is generally produces a better looking, and order-independent result than just using a pair of triangles.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.