Reply 140 of 144, by Dolenc
More rambling...
My two-pass Trilinear didnt go so well, it has some random black textures appearing on surfaces. Performance doing multitexturing for base texture + lightmaps, then two passes for trilinear was also lower than single-pass trilinear and no multitexturing (suprised)... So I decided to abandon it.
The issue with having Trilinear, so blending two mips of a texture togethere in one cycle, having only 2 tmus.
Is that you have either multitexturing(combining texture + lightmap in a single pass) OR do Trilinear in single pass. To do both you would need 4 TMUs.
And you cant dinamicly say... Oh game wants Trilinear, np, we disable multitexturing so we have TMUs ready...Because thats not the first thing that a game queries, so you cant do it on the fly. You have to "report" no multitexturing, for the game to switch to multy-pass rendering, and then you can do your trilinear...
So the way I currently have it, there is a toggle!!
By default, it will be the same behavior as now, if Trilinear is requested, fallback to Bilinear filtering.
Or you can Enable Trilinear.
What that does is it reports no multitexturing support, so game switches to multy-pass texturing. And you can enable Trilinear. You still have to set Trilinear (GL_LINEAR_MIPMAP_LINEAR) in-game.
Then you have your two TMUs free to handle blending.
But you have to toggle it back to Disabled if you gonna use Bilinear, since this will keep multitexturing disabled, no matter the filtering.
Thats the best I could figure out how to implement it 😀
Quick performance numbers
Quake 3 1280x1024
Bilinear: 71.6fps
Trilinear toggled in driver(no multi), but not enabled in-game: 55.2fps
Trilinear enabled: 49.3fps
Sin 1280x960
Bilinear: 85.8fps
Trilinear toggled: 74.1fps
Trilinear enabled: 66.3fps
If anyone wants to play around with it, Ive updated the files on github and you can download clone/zip of latest files.
Heres a random picture that happened when I was playing with it