TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Perspective-Correct Interpolation

54 pointsby nicopappl11 months ago

6 comments

sylefeb11 months ago
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&lt;6 ;) ).<p>For anyone interested: I have a detailed write up on the topic here in the context of 1990s renderers <a href="https:&#x2F;&#x2F;github.com&#x2F;sylefeb&#x2F;tinygpus&#x2F;tree&#x2F;main?tab=readme-ov-file#on-perspective-correct-texturing">https:&#x2F;&#x2F;github.com&#x2F;sylefeb&#x2F;tinygpus&#x2F;tree&#x2F;main?tab=readme-ov-...</a> ; a video discussing texture mapping with a hardware twist <a href="https:&#x2F;&#x2F;youtu.be&#x2F;2ZAIIDXoBis?si=MvQXH2ltqWmvFMdt&amp;t=1072" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;2ZAIIDXoBis?si=MvQXH2ltqWmvFMdt&amp;t=1072</a> ; and have a shadertoy to compare perspective correct texture mapping on&#x2F;off <a href="https:&#x2F;&#x2F;www.shadertoy.com&#x2F;view&#x2F;ftKSzR" rel="nofollow">https:&#x2F;&#x2F;www.shadertoy.com&#x2F;view&#x2F;ftKSzR</a>
magicalhippo11 months ago
Reminded me of Quake&#x27;s trick[1] of calculating the perspective correction every 16 pixels, as you then effectively got it for free on a Pentium processor.<p>[1]: <a href="https:&#x2F;&#x2F;www.bluesnews.com&#x2F;abrash&#x2F;chap68.shtml" rel="nofollow">https:&#x2F;&#x2F;www.bluesnews.com&#x2F;abrash&#x2F;chap68.shtml</a>
评论 #40660560 未加载
评论 #40672816 未加载
ggambetta11 months ago
An alternative explanation: <a href="https:&#x2F;&#x2F;gabrielgambetta.com&#x2F;computer-graphics-from-scratch&#x2F;14-textures.html#pespective-correct-texture-mapping" rel="nofollow">https:&#x2F;&#x2F;gabrielgambetta.com&#x2F;computer-graphics-from-scratch&#x2F;1...</a>
meindnoch11 months ago
I think computing 2D barycentric coordinates by inverting a 3x3 matrix whose last column is [1, 1, 1] is a bit wasteful.<p>The proper solution is this: <a href="https:&#x2F;&#x2F;gamedev.stackexchange.com&#x2F;a&#x2F;63203" rel="nofollow">https:&#x2F;&#x2F;gamedev.stackexchange.com&#x2F;a&#x2F;63203</a>
reasonableklout11 months ago
[author] Thanks for reposting this! It was a small but cool learning that all perspective correction needs is dividing screen-space barycentrics by vertex depths and normalizing. I wanted to share my understanding of the math.<p>3D graphics is a rich and old field with lots of tricks like this. It&#x27;s cool to see faster algorithms and alternative explanations in the comments!
nmeofthestate11 months ago
The funny thing about this was that by the time you&#x27;d finished a 10 hour session of Tomb Raider you got used to the effect, so reality looked weirdly distorted for a while after.