One for Harry This emulates bilinear filtering in the shader .. also correctly handles the weird non smooth texture repeat, which is actually a combination in opengl of something like .. GL_CLAMP_TO_EDGE and GL_REPEAT. No equivalent function exists in opengl. Currently I fudged a solution by stretching the texture coordinates inside the polys to not sample the edge pixels, but this has its draw backs (ie doesn't work with mipmapping). This should improve the situation.

If we can add your code for pixel dilate for contour or alpha textures, and add in mipmapping, we'll have a very accurate emulation of what the model3 is doing.

What is happening here, instead, is that the edge texels "bleed" toward the "outer", transparent, texture area copying their RGB values there, while leaving the alpha channel intact. Infact the texture edge is cut in respect of the original alpha value, while its color is replicated from the "inner" texels.

This fixes, with the appropriate contour threshold, all the ugly white/black borders (but even some colored ones) in contour textures.

I think he was 100% correct in what was happening. But a bilinear filter is just 4 texture samples. Seems unlikely they would have used 9 texture samples to achieve this ..

Anyway I tried modifying regular bilinear filtering to achieve this (ie with 4 samples ..) and this is the result

I just fetch the 4 texture samples. Then for each one check the 2 adjacent pixels and if necessary copy their colour, leaving the alpha untouched.