I'm trying to figure out how to implement texture perspective correction in a software renderer. Anyone can explain me how is it supposed to work ?
I'm trying to figure out how to implement texture perspective correction in a software renderer. Anyone can explain me how is it supposed to work ?
Currently, i'm interpolating u/w, v/w and w and i multiply the interpolated values by w to find the texture coordinates of each points.
It seems to work most of the time but not always. The problem seems to be the clipped triangles especially when w is around 0... I don't know how to change texture coordinates when i clip to w~=0
Why are you not asking the type of the hq2-4x filters.
The objects he is filtering seems that there is a texture perspective correction used.
You know the website? http://www.hiend3d.com/smartflt.html
It's just a try. Hope it helps (or it's the right thing I'm thinking...)
The Future of Emulation: Emulate a High End Computer on a Low End System
Main: Intel Core i7 (Lynnfiled) 860 (@3.802Ghz) | 8 GB DDR3-1333 | ATI XFX HD 5750 PCI-E | ATI High Definition Audio Device | 256 GB SSD + 3 TB Internal SATA2 + 4 TB external | Windows 7 Professional X64 SP1 MSDNAA
Netbook: Asus EeePC 1015PEM | Intel Atom Dual Core N550 (1,5GHz) | 2GB DDR3-1066 | Intel GMA 3150 | 250GB HDD | Win 7 Starter
Old One: AMD Athlon 64 X2 4200+ (2x2.5Ghz; S939) | MSI KbT Neo2-F V2.0 | 2x1GB Corsair Value VS1GBKIT400 | Radeon HD 3850 512 MB/AGP8x | Creative SB Audigy LS | 2TB (4x500GB SATA2 HDDs Raid0) | Windows 7 Business X64 SP1 MSDNAA
Perspective correction is different than texture filtering. Without perspective correction, textures look like what you get on a PSX... Nowadays, perspective correction is achived automatically by all 3d hardware. But here's i'm trying to do a software renderer. A software renderer is fun to implement but you have to face a lot of problems that have been eradicated for ages by various api or hardware.
I'm pretty sure now, that i've implemented it correctly except for triangles that are clipped at w=0.
Well, i've finally found a solution, it's probably mathematically incorect but at least, it's not visible![]()
The reason you are having trouble is that you're supposed to clip your triangles in 3D space to the frustum planes, way before worrying about interpolating u/w and stuff
If you do that there will be no problems like this whatsoever.
yea... would have been easier to do it this way but.... it's in a n64 gfx plugin and i was trying to code it like the original ucode. And this ucode is transforming each vertex with the modelview and projection matrix before defining the triangles and clipping them, so i was supposing there was a way to clip after the projection....
ah ok, makes sense.