### MipLevels = 13

Expanding and utilizing the engine via C++.

#### MipLevels = 13

chriscalef
Posts: 398
Joined: Mon Feb 09, 2015 7:48 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.

#### Re: MipLevels = 13

Duion
Posts: 1636
Joined: Sun Feb 08, 2015 1:51 am

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.

#### Re: MipLevels = 13

marauder2k9
Posts: 418
Joined: Wed Feb 18, 2015 7:36 am
Could you tell me why your texture has to be that big?

Also could you tell me what format the texture is?

#### Re: MipLevels = 13

Duion
Posts: 1636
Joined: Sun Feb 08, 2015 1:51 am

He already told you, it is to reduce load on the GPU and improve performance, it is called atlas texture.

#### Re: MipLevels = 13

marauder2k9
Posts: 418
Joined: Wed Feb 18, 2015 7:36 am
i know what a texture atlas is im asking why it has to be 16384

#### Re: MipLevels = 13

chriscalef
Posts: 398
Joined: Mon Feb 09, 2015 7:48 pm
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.

#### Re: MipLevels = 13

marauder2k9
Posts: 418
Joined: Wed Feb 18, 2015 7:36 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?

#### Re: MipLevels = 13

chriscalef
Posts: 398
Joined: Mon Feb 09, 2015 7:48 pm
Yeah, png.

#### Re: MipLevels = 13

marauder2k9
Posts: 418
Joined: Wed Feb 18, 2015 7:36 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

#### Re: MipLevels = 13

chriscalef
Posts: 398
Joined: Mon Feb 09, 2015 7:48 pm
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.

#### Who is online

Users browsing this forum: No registered users and 3 guests