I’m using the “NVIDIA Texture Tools Exporter” in Photoshop. If I load in a 2048x2048 cube-map texture with mip maps enabled, such as for a specular IBL image, it becomes impossible to save the image due to the CUDA error message - something like “Error: The width is larger than the maximum CUDA texture dimensions on this system”
The reason the width of the image appears to be so ridiculous is because of 2 reasons:
The image contains all 6 sides of the cube map arranged horizontally
The image contains all levels of the mip maps, arranged horizontally.
Because of this, a mere 2K cube map ends up becoming 24570 pixels wide.
However, that width is only an “illusion”. Once the exporter arranges the sides of the cube map correctly, then restores the mip levels back to being mips, the width of the image will drop down to a size compatible with CUDA. So even though the exporter is entirely capable of saving the data, whoever wrote the error check line didn’t consider these things.
Instead of checking for the width violation before options are chosen, the program should have checked after the user is able to select cube-map and mip saving during export option setup. It is only after this point that it can actually know the real size of the image.
Does anyone know of a reasonable way around this limitation?
We can automatically detect this layout when the Texture Type is set to Cube Map, although I think we still load DDS cubemaps in the linear format by default. With this configuration (and with custom mips), it would wind up being 16380 pixels wide, which should be just small enough.
(Alternatively, if you’re OK with the mips the Texture Tool generates, you could remove all the mips except for the base mip; then the linear format fits in a 12288-pixel-wide texture, and the +- format fits in a 8192-pixel-wide texture.)
Good catch on the error message! I’ll make sure to turn this into a warning rather than an error in the next version. The risk is that if someone changes Texture Type from Cube Map to 2D Texture, we wind up generating the full-width version, and exceeding the maximum texture width for CUDA processing on the GPU. But in practice, that’s not so bad; we’d catch the error and fall back to CPU processing (which would be slower, but unblock the user in this case).
In my situation, I’m loading in a generated cube map texture (made with an app called IBL Baker), and trying to directly save that image as a different cube map format. So the only way to arrange the planes of the cube would be to do it manually. And since there are 9 levels of mips, I would have to manually rearrange each one individually for every texture I load in and resave.
I may be able to locate a script for Photoshop to rearrange the cube sides automatically, but I’m not sure such a script would be smart enough to work around the mip level textures that are also present.
The mips for the texture are part of an irradiance map, where each mip in the chain is “blurrier” than the last, to represent rougher and rougher surface reflections. So (re)generating them would not be as straight forward as it would be with standard textures.
I will look into a way to possibly rearrange the sides of the cube until the issue is resolved. I appreciate the advice and information!