[HN Gopher] Perspective-Correct Interpolation
       ___________________________________________________________________
        
       Perspective-Correct Interpolation
        
       Author : nicopappl
       Score  : 43 points
       Date   : 2024-06-11 09:35 UTC (2 days ago)
        
 (HTM) web link (andrewkchan.dev)
 (TXT) w3m dump (andrewkchan.dev)
        
       | ggambetta wrote:
       | An alternative explanation: https://gabrielgambetta.com/computer-
       | graphics-from-scratch/1...
        
       | meindnoch wrote:
       | I think computing 2D barycentric coordinates by inverting a 3x3
       | matrix whose last column is [1, 1, 1] is a bit wasteful.
       | 
       | The proper solution is this:
       | https://gamedev.stackexchange.com/a/63203
        
       | magicalhippo wrote:
       | Reminded me of Quake's trick[1] of calculating the perspective
       | correction every 16 pixels, as you then effectively got it for
       | free on a Pentium processor.
       | 
       | [1]: https://www.bluesnews.com/abrash/chap68.shtml
        
         | atilimcetin wrote:
         | I remembered the same. Perspective correction needs a division
         | operation for each pixel and while drawing a scanline,
         | calculating it every 16 pixels and linearly interpolating
         | between them make a huge speed difference.
        
         | Findecanor wrote:
         | I remember that Descent, released earlier, had used the same
         | trick.
        
       | sylefeb wrote:
       | This is a fascinating topic, especially when considering how this
       | was achieved back in the days. We now take it for granted, but
       | this was not a simple feature to have in your game in 199x ( x<6
       | ;) ).
       | 
       | For anyone interested: I have a detailed write up on the topic
       | here in the context of 1990s renderers
       | https://github.com/sylefeb/tinygpus/tree/main?tab=readme-ov-... ;
       | a video discussing texture mapping with a hardware twist
       | https://youtu.be/2ZAIIDXoBis?si=MvQXH2ltqWmvFMdt&t=1072 ; and
       | have a shadertoy to compare perspective correct texture mapping
       | on/off https://www.shadertoy.com/view/ftKSzR
        
       | nmeofthestate wrote:
       | The funny thing about this was that by the time you'd finished a
       | 10 hour session of Tomb Raider you got used to the effect, so
       | reality looked weirdly distorted for a while after.
        
       ___________________________________________________________________
       (page generated 2024-06-13 23:01 UTC)