<p>Use cases are only limited by your imagination! <code>noperspective</code> means that the attribute is interpolated across the triangle as though the triangle was completely flat on the surface of the screen. You can do <a href="http://orbit.dtu.dk/fedora/objects/orbit:55459/datastreams/file_3735323/content">antialiased wireframe rendering</a> with this: output a screen-space distance to the nearest edge as a <code>noperspective</code> varying and use that as coverage in the pixel shader.</p>

<p>Or if you're doing non-photorealistic rendering and want a pattern in screen-space like <a href="https://en.wikipedia.org/wiki/Halftone">halftoning</a>, you can enable <code>noperspective</code> on your UVs used for texturing.</p>

<p>Does it make a performance difference? Probably, but you probably won't notice (with the potential exception of less powerful graphics hardware). Most GPUs are composed of a series of pipeline stages that execute in parallel, and in some sense you only pay the cost for the most expensive stage. If rasterization is the most limiting part for you, then you may see a difference from the divisions that you're skipping per-pixel. I would guess that is most likely when rendering a shadow map or a depth prepass, but those also have the fewest attributes to interpolate.</p>

CC BY-SA 3.0
2015-08-05T14:03:44.697Z
2015-08-05T14:03:44.697Z
John Calsbeek
<p>In GLSL, perspective correct interpolation of vertex attributes is the default setting - one can disable it for specific vertex attributes by using the <em>noperspective</em> qualifier. Other than in post-processing shaders, I've never seen the perspective correct interpolation disabled - are there any other use cases? Also, does it even make a difference, performance-wise?</p>

<opengl><glsl><performance>
When to disable perspective correct interpolation ( noperspective )
gemse
# When to disable perspective correct interpolation ( noperspective )

(Asked by: username_0 on 2015-08-05)

In GLSL, perspective correct interpolation of vertex attributes is the default setting - one can disable it for specific vertex attributes by using the *noperspective* qualifier. Other than in post-processing shaders, I've never seen the perspective correct interpolation disabled - are there any other use cases? Also, does it even make a difference, performance-wise?

**Tags:** opengl, glsl, performance


---

## 1 answers

### Answer by username_1 on 2015-08-05. Score: 15 | Accepted answer

Use cases are only limited by your imagination! `noperspective` means that the attribute is interpolated across the triangle as though the triangle was completely flat on the surface of the screen. You can do [antialiased wireframe rendering](http://orbit.dtu.dk/fedora/objects/orbit:55459/datastreams/file_3735323/content) with this: output a screen-space distance to the nearest edge as a `noperspective` varying and use that as coverage in the pixel shader.

Or if you're doing non-photorealistic rendering and want a pattern in screen-space like [halftoning](https://en.wikipedia.org/wiki/Halftone), you can enable `noperspective` on your UVs used for texturing.

Does it make a performance difference? Probably, but you probably won't notice (with the potential exception of less powerful graphics hardware). Most GPUs are composed of a series of pipeline stages that execute in parallel, and in some sense you only pay the cost for the most expensive stage. If rasterization is the most limiting part for you, then you may see a difference from the divisions that you're skipping per-pixel. I would guess that is most likely when rendering a shadow map or a depth prepass, but those also have the fewest attributes to interpolate.


---

