MipLevels = 13

Expanding and utilizing the engine via C++.
27 posts Page 1 of 3
chriscalef
Posts: 398
Joined: Mon Feb 09, 2015 7:48 pm
by chriscalef » Thu Apr 16, 2020 8:15 pm
Just wanted to drop a comment here, in case anyone else ever runs across this issue, it took me a second to figure out what the problem was.

The symptom: I was trying to import a set of building models which all reference the same huge texture, in order to reduce load on the graphics card. Great strategy, but when I tried to load it in Torque I got a hard crash every time. On debugging, I got a message about mipLevels greater than maxMipLevels.

The solution: after searching around a while I found the following in gfx/bitmap/gBitmap.h:

Code: Select all

c_maxMipLevels = 13;
The comments indicate that 13 takes you up to 4000 pixels or so, but my situation requires 16384 pixels high, so I jacked that up to 15 and now it works.

I don't know if there are any negative side effects to doing this, does it allocate a giant buffer somewhere for every image now, or something terrible like that? I haven't noticed any ill effects so far anyway.
Duion
Posts: 1622
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Thu Apr 16, 2020 9:14 pm
I don't know what the current standard of texture sizes are, but I guess the potato PC owners will complain when their potato GPU cannot handle 16k textures. 4k textures are pretty safe and everyone nowadays should have a GPU that can handle those, however I don't know how it is with bigger ones.
marauder2k9
Posts: 418
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Fri Apr 17, 2020 1:18 am
Could you tell me why your texture has to be that big?

Also could you tell me what format the texture is?
Duion
Posts: 1622
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Fri Apr 17, 2020 1:52 am
He already told you, it is to reduce load on the GPU and improve performance, it is called atlas texture.
marauder2k9
Posts: 418
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Fri Apr 17, 2020 2:31 am
i know what a texture atlas is im asking why it has to be 16384
chriscalef
Posts: 398
Joined: Mon Feb 09, 2015 7:48 pm
by chriscalef » Fri Apr 17, 2020 2:57 am
I didn't create it, so I don't know why it has to be 16384, I expect the FlightGear artists just kept making it bigger and sticking more textures onto the bottom of it. It's only 256 pixels wide.
marauder2k9
Posts: 418
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Fri Apr 17, 2020 2:57 am
I didn't create it, so I don't know why it has to be 16384, I expect the FlightGear artists just kept making it bigger and sticking more textures onto the bottom of it. It's only 256 pixels wide.
Ah okay, and what is the texture format is it png?
chriscalef
Posts: 398
Joined: Mon Feb 09, 2015 7:48 pm
by chriscalef » Fri Apr 17, 2020 3:05 am
Yeah, png.
marauder2k9
Posts: 418
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Fri Apr 17, 2020 3:14 am
Yeah, png.
That may be your problem, as i understand it mip maps are generated automatically for png and jpg when imported into torque, with the hard coded limit of 13, this means each level the image drops by po2 till it gets to a 1x1. Because it isnt getting to 1x1 its throwing out that error. You could convert the image to DDS and define your own mipmapping without having to change that setting.

A texture of that size 16384 x 256 will take up a lot of VRAM to load in to the GPU
chriscalef
Posts: 398
Joined: Mon Feb 09, 2015 7:48 pm
by chriscalef » Fri Apr 17, 2020 5:18 am
Any idea how much would be a lot? And would it be affecting performance in any other way? I'd rather not have to define my own mipmapping unless the cost is significant, because I'm lazy and don't like to work. :-)
27 posts Page 1 of 3

Who is online

Users browsing this forum: No registered users and 4 guests