• Welcome to Dark Bit Factory & Gravity.
 

Perspective correct texture mapping problems...

Started by Dr_D, January 25, 2010

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

hellfire

Are you sure that this
for y as integer = y1
performs the same rounding as you imply here:
1 - (ceil(inval) - inval)
?
"sub_pix" won't work for "ceil(i)=i", eg. i= 5.0.
Challenge Trophies Won:

Dr_D

Yeah, that rounding would be different since fb's integer rounding by default only scales up when it's >= .5. I've modified that bit to use the ceil function, making it consistent across all variables. I've also used ceil for converting the y loops to integer, but it's still acting weird. I have to find where that dn calculation is drifting to infinity... I'm sure that's it, it so close now. :crutches:
The Dr. is INsane!!!

Jim

Quotefb's integer rounding by default only scales up when it's >= .5
No,
5.5 will round up to 6
4.5 will round down to 4

Jim
Challenge Trophies Won:

Dr_D

Damn, I never noticed that.. I guess that's what Stonemonkey mentioned. It makes sense now. :p
The Dr. is INsane!!!

Stonemonkey

Quote from: Jim on February 28, 2010
Truncating all your x,y floats towards 0 when rendering is enough to ensure you never get cracking, though Stonemonkey is bang on to say that that's not perfect - it's very good though.  There's no need to perspective correct your r,g,b imho, there's enough error in the fact your using Gouraud and the RGB colour-space to make it irrelevant, just perspective correct the u,v, which is really important.

Jim

I'm of a slightly different opinion with regards to perspective correct rgb/shading, if it's on a textured surface then it's not really noticable but if the surface is a single colour then it can be. As you already have 1/(1/z) to get u and v then it's only an extra mul for each extra component in the inner loop.

For the first time in a while I've been looking at some code, as usual this is some cubes. With perspective correct shading and more accurate normal calculation than just averaging. Even though it's not textured I think the visible banding in the shading is due to the bi linear filtering and the shading calcs being combined. The bend in the shading is still a little noticable at some extreme angles but not noo bad.

L/R mouse buttons turn, both together move forward.