Hello,
I’m working on on a project pipeline, Maya to Unity, and I’ve set up all the color for the 3D assets as simple color ramps in Maya. I export all the ramps to texture files using mel’s composite command(Hypershade > Edit > Convert To File Texture (Maya Software)). The resulting image files have banding in them, I’m assuming the typical 8bit per channel banding that I think requires 16 or 32 bit color to fix. I tried tif, iff, psd, dds, etc and they give me textures with banding, there’s no option for bit depth in that particular window, I’m not very familiar with linear workflows, and I can’t seem to find anything online… so yeah I’m stuck.
The command looks like this:
import pymel.core as pm
pm.mel.composite(1024, 1024, 'textureFileName', 'tif', 'images', 1, 1, 1, 0, 1)
Does anyone have any ideas? I was thinking about trying to pull the ramp data from Maya and just regenerate the texture files with PIL or something. Before I get into that it would be great if there was just some switch in Maya that I didn’t know about
The function you’re using will always output in 8-bit format. I figured this out by running the following mel command:
whatIs composite
If it’s a custom mel script (like this one) it will tell you where it’s saved, and as such you can look at its source code.
Looking at the source code it’s using the convertSolidTx method to perform the conversion to a file texture.
And its documentation shows a parameter called pixelFormat that as it states: “Specifies the pixel format of the image.”
I’ve never used the composite or convertSolidTx functions before. Looking at the source code of the composite function and if you know what you’re doing you’ll be able to rewrite your code to roll your own method that does allow 16 bit saving.
If you need something ASAP and you love quick and dirty then you could change Maya’s .mel file so that it writes 16 bit files by adding in the argument. Of course that would only work locally on the workstation you changed the file… and I wouldn’t recommend it. Yet you never know how rushed someone is.
Does that help?
You can apparently specify the bit depth (from your link above)
-pixelFormat(-pf) string create
[INDENT]Specifies the pixel format of the image. Note that not all file formats support all pixel formats. Available options:
“8”: 8 bits per channel, unsigned (0-255)
“16”: 16 bits per channel, unsigned (0-65535)
Default is “8”.[/INDENT]
EDIT: oh, sorry, I thought you were saying that you’d have to recompile from source to get 16 bit support. Also, I’ve never had significant issue with banding in 8 bit images. Sure if you go below that, or use a format such as dds you’ll get banding. You might want to see how much the RGB values jump between bands. 8 bit might not be the issue.
[QUOTE=BigRoyNL;28856] Does that help?[/QUOTE]
Yes! Very much so! Thanks for looking into that.
I’ve gone down that road many times, looking in maya startup scripts, I just forgot all about it. And I didn’t know about that whatIs command, which is much faster than my ‘find in files’ method of finding relevant info.
At my old job we used to make a copy of the function and it would get loaded after it to override, just to not mess with Maya’s source and it works well… In this case it’s only me working, so I can be free to be sloppy.
I’ll try it out and post my findings