Monday, 7 September 2009

Dude... Affine Triangles like ... Suck!

So we’ve talked about the project up to 2007 – It was at this point that I finally put a realistic texture on the object you see in the 3rd post instead of the image from previous screenshots. Then we noticed…

Dude - affine* texture mapping on triangles looks freakin' terrible. (Sorry I've been watching a lot of Lost recently - just watched the episode Tricia Tanaka is Dead, 'He has a name dude, it's Roger Workman'). Anyway two main problems were obvious:

  1. For a quadrilateral object, the textures on the two triangles often didn't line up by a pixel or so...so you had an offset along the diagonal of a wall for example - not a problem close up, but bad at a distance (as above - if you look at the doors you can see the effect most clearly)
  2. As the angle to the poly became more slight, the diagonal shifted so that for a quad you get one fat and one thin tria. This is probably ok with perspective correct texture mapping** but with affine mapping* has the effect of shifting textures up and down the 'wall' for example - mmmmm nice... windows that slide up and down walls!


  • ** Perspective correct texture mapping takes into account the distance of the part of the polygon being drawn from the viewpoint, thus as the polygon recedes, the texture gets tighter and smaller, with * affine texture mapping, the distance of the pixels being draw is not considered, but mapped onto the polygon as if everything was simple 2D.

A panic set in - this far down the road and it looks ghastly?! Nearly as bad as Black Ice/White Noise in fact.

After the panic came depression - it was going to be a LOT of work to put that right. I experimented like crazy for a couple of weeks, splitting trias, re-ordering nodes, etc., nothing fixed it. I became kind of despondent and left the project alone for quite a long time - too much work was no longer useful - really wondering if it was worth continuing with something so ugly.

For the first time, I did not attend JagFest UK, and was seriously considering quitting.


After a while Raven and I did some talking and thinking about it, and decided to have a go at fixing it, if I could do so fairly quickly. So, I bit the bullet and went into a re-write of the poly renderer (the part of the code which converts the mathematical definition of the 3D polygon projected onto the 2d plane of the screen into actual pixels) from scratch again, no longer concerning myself with just triangles, and using what I'd learned from the first engine.



Then came 2008, which was a difficult year for us. There's no need for details, but sometimes life just gives you something far more important to worry about than Video Games. (My elderly mother contracted cancer and passed away in November - Raven)


2009, on the other hand has eventually seen a return to coding, new demos of which will be shown at JagFest on the 19th.


Cheers,

Joe(Atari Owl)

1 comment:

  1. Dude, I can tell you that this looks promising. I can´t even begin to imagine the technical difficulties you have to overcome, but I like what I am seeing on the screenshot already.

    Please keep up the good work, and good luck to you and your team!

    ReplyDelete