<p>It sounds like you want to know how to ray trace <em><strong>a bilinear surface patch</strong></em>.</p>
<p>A quick search <a href="http://shaunramsey.com/research/bp/" rel="nofollow noreferrer">turned up this page</a> by Ramsey, Potter &amp; Hansen, which includes a <a href="http://shaunramsey.com/research/bp/ramseybilinear.pdf" rel="nofollow noreferrer">paper</a> and, probably better still, <em>source code</em>!</p>
<p>However, if you just want a &quot;cheap and cheerful&quot; <strike>hack</strike> approach, you could try replacing the quad with <strong>4</strong> triangles. That is, by adding 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.</p>

CC BY-SA 4.0
2019-10-01T08:27:09.497Z
2024-01-29T14:33:38.097Z
2024-01-29T14:33:38.097Z
Simon F
<p>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).</p>

<p>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?</p>

CC BY-SA 4.0
2019-09-30T16:11:12.290Z
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.
Kyy13
CC BY-SA 4.0
2019-09-30T16:28:09.007Z
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
Kyy13
<model>
How to handle quads?
AnnoyinC
# How to handle quads?

(Asked by: username_0 on 2019-09-30)

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?

**Tags:** model

> **Comments:**
> **username_1**: 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.  
> **username_1**: 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  

---

## 1 answers

### Answer by username_2 on 2019-10-01. Score: 4 | Accepted answer

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

A quick search [turned up this page](http://shaunramsey.com/research/bp/) by Ramsey, Potter & Hansen, which includes a [paper](http://shaunramsey.com/research/bp/ramseybilinear.pdf) 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 adding 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.


---

