View Full Version : Texture perspective correction
Hacktarux
September 28th, 2004, 15:19
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 ?
Hacktarux
September 28th, 2004, 18:49
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
MasterPhW
September 29th, 2004, 15:03
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... :P)
Hacktarux
September 29th, 2004, 15:38
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.
Hacktarux
September 29th, 2004, 15:52
Well, i've finally found a solution, it's probably mathematically incorect but at least, it's not visible ;)
ector
September 30th, 2004, 23:05
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.
Hacktarux
September 30th, 2004, 23:27
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....
ector
October 1st, 2004, 00:11
ah ok, makes sense.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.