TextureManagers' small textures; what's up with those?
by Sander Van Rossen · in Torque Game Engine · 04/22/2003 (4:37 am) · 16 replies
I noticed that the TextureManager has a function called setSmallTexturesActive
with which you can force all textures to use a smaller version of themselves
Basically just about every texture is stored twice, one with the original size, and one which is 1/4 in size.
If i interpret it correctly, it seems like the smaller texture is used after a given distance instead of the highres version
I tried turning it off, and on my geforce2go i didn't notice any performance difference...
yet it seems to really overcomplicate the whole texture management and seems like a horrible hack imho..
Wouldn't it be better to just remove this not very usefull functionality from torque head?
with which you can force all textures to use a smaller version of themselves
Basically just about every texture is stored twice, one with the original size, and one which is 1/4 in size.
If i interpret it correctly, it seems like the smaller texture is used after a given distance instead of the highres version
I tried turning it off, and on my geforce2go i didn't notice any performance difference...
yet it seems to really overcomplicate the whole texture management and seems like a horrible hack imho..
Wouldn't it be better to just remove this not very usefull functionality from torque head?
#2
but these 'small textures' seem to amplify the effect
so it's quite possible that without these 'small textures' it'll look a whole lot better..
Edit:
I've actually looked at the water level with and without the 'small textures' and i couldn't see any difference..
But then again, the water level isn't a good test level for that; yours would be a lot better..
04/22/2003 (4:59 am)
well that effect is always present in some degree or another (on sharply angled polygons at least), unless you use anisotrophic filtering..but these 'small textures' seem to amplify the effect
so it's quite possible that without these 'small textures' it'll look a whole lot better..
Edit:
I've actually looked at the water level with and without the 'small textures' and i couldn't see any difference..
But then again, the water level isn't a good test level for that; yours would be a lot better..
#3
I know this thread is old, but I disabled this "feature" too.
static void setSmallTexturesActive(const bool t) {/*!!*/}
It fixed a hideous blurry texture problems on some dts files with IFL materials. At first I thought there was something up with the mipmap bias.
Can anyone familiar with the code involed point out any negative effects I should be looking for?
Thanks!
02/04/2005 (9:16 am)
Thanks Sander.I know this thread is old, but I disabled this "feature" too.
static void setSmallTexturesActive(const bool t) {/*!!*/}
It fixed a hideous blurry texture problems on some dts files with IFL materials. At first I thought there was something up with the mipmap bias.
Can anyone familiar with the code involed point out any negative effects I should be looking for?
Thanks!
#4
Can someone explain what this is for?
Thanks
Todd
02/03/2006 (4:18 pm)
I am adding DDS support to TGE and this "small texture" code in the TextureManager has me confused as well. Can someone explain what this is for?
Thanks
Todd
#5
It's a pretty cool thing, and something that's finally coming into vogue with more game engines... ;)
02/03/2006 (4:50 pm)
TGE keeps small versions of textures around to save GPU memory. It means if you have a lot of objects in view at once, at a distance, you'll be using a bunch of small textures reducing cache thrashing and video memory paging. It's basically a mip-paging optimization - in essence bigger mip levels are paged out when they're not needed.It's a pretty cool thing, and something that's finally coming into vogue with more game engines... ;)
#6
The distance when the textures switch is hardcoded in Shapebase iirc, and also doesn't take the scale of the shape into account... we had the problem that the texture switch happened way too early when we scaled the models up by 2 in a mission, so I just multiplied the value with 2 * objectscale or something ;) if I find the time maybe I make that a script or prev var or something and post the changes here :)
02/04/2006 (12:59 am)
Yeah, it's a cool feature... could be a bit more flexible though ;)The distance when the textures switch is hardcoded in Shapebase iirc, and also doesn't take the scale of the shape into account... we had the problem that the texture switch happened way too early when we scaled the models up by 2 in a mission, so I just multiplied the value with 2 * objectscale or something ;) if I find the time maybe I make that a script or prev var or something and post the changes here :)
#7
02/04/2006 (1:04 am)
Like Dave Moore notes in his comments in the interior code, it's nothing more than eyeball code... you could assuredly do a pixel metric and get fantastically better results. :)
#8
07/17/2006 (4:12 am)
I disagree that this is truly a cool thing in the general case. What happens if in the same view I have two instances of the same object (or even two different objects sharing the same texture) and one is near and the other far away? As far as I understand from the code, the implementation sends both the large and the small texture to the GPU, therefore increasing the cache thrashing instead of reducing it. According to the type of the game, this case might actually occur more often than the "best" case where there's only one instance of each texture in the entire level. Detecting the "worse" case looks like a nighmare to me, so at least there should be a way to manually disable this feature on an per-texture base. For the time being, I chose the simpler path to just disable the feature completely.
#9
07/17/2006 (4:23 am)
Hmmm, good question.
#10
Always measure before you cut, to quote some advice for tailors. :)
07/17/2006 (10:32 am)
It's not going to thrash because they're stored in seperate texture objects. So you have some overhead in this case, but no performance loss - and the small textures are pretty small, so it's not an unreasonable cost to pay.Always measure before you cut, to quote some advice for tailors. :)
#11
07/17/2006 (10:35 am)
I thought the quote was... measure twice, cut once.
#12
07/17/2006 (10:49 am)
Better once than never. ;)
#13
07/17/2006 (11:10 am)
Fair enough!
#14
07/17/2006 (4:16 pm)
Well, I did measure before cutting. It's pretty arrogant for you to think I didn't. BTW, did you measure before writing? It might be interesting to see the numbers. In my particular case there was no advantage whatsoever with small textures and as the most typical case is the one the I described in my post, I did not see the reason to keep that "overhead" however small it may be. Anyway, the "cut" was simply to add a console variable to turn the feature on and off (barely three lines of code) so it wasn't really something that I might regret doing.
#15
No thrashing occurs in this situation unless the game is already exceeding available VRAM. I have measured this code, and, in fact, it doesn't thrash, unless you are exceeding available VRAM, in which case you're in trouble anyway...
I don't think it's a bad idea to disable it, I'm just pointing out that the example you gave isn't, in my experience, something that actually happens.
Sorry if it came off as arrogant! :)
07/17/2006 (4:20 pm)
You said:Quote:
What happens if in the same view I have two instances of the same object (or even two different objects sharing the same texture) and one is near and the other far away? As far as I understand from the code, the implementation sends both the large and the small texture to the GPU, therefore increasing the cache thrashing instead of reducing it.
No thrashing occurs in this situation unless the game is already exceeding available VRAM. I have measured this code, and, in fact, it doesn't thrash, unless you are exceeding available VRAM, in which case you're in trouble anyway...
I don't think it's a bad idea to disable it, I'm just pointing out that the example you gave isn't, in my experience, something that actually happens.
Sorry if it came off as arrogant! :)
#16
after testing on several modern machines and one old clunker machine w/ a GeForce 2.
i've tried the default "dynamic" small textures, as well as forcing them always on and always off.
the scene is quite heavy, texture-wise.
as a result i've also disabled small textures as some of the early posters in this thread indicated.
07/17/2006 (4:51 pm)
I've seen zero performance change from using small textures,after testing on several modern machines and one old clunker machine w/ a GeForce 2.
i've tried the default "dynamic" small textures, as well as forcing them always on and always off.
the scene is quite heavy, texture-wise.
as a result i've also disabled small textures as some of the early posters in this thread indicated.
Torque Owner Very Interactive Person