Skip to content

3ds Max PNG Alpha Transparency and Anti-Alias Problem (SOLVED)

With every new year and every 3Ds Max Version, I try again to understand why this is never fixed and how to find a better solution to this annoying issue. It is simple (or should be simple) if you have an image with transparency info (alpha channel) and you want it to show nicely no matter the background. In the image above, you see a dark halo on the borders that looks horrible. The same happens if the background is white in the render and later when you composite it over a black background – you still see white borders.

This also affects anti-aliasing, which depends on transparency. So even you don’t use translucent materials, your object could have issues on its borders when you composite the image in any 2D editing program or game engine.

The following is the correct way of how you want a PNG with transparency to behave:

Then when I google it, there are only a few people who share this concern. In the forum discussions, you find many different opinions, complex solutions and fights about whether it is 3Ds Max’s fault or Photoshop fault… or my own fault for being so dumb that I never found that secret super-hidden configuration that makes 3Ds Max save .PNG right.

A simple test finds out who is guilty. Open your 3Ds Max .PNG on Gimp 2, or drag it to a new Gmail message. Try anywhere else and you will see that it will show up wrong with the black or white background borders.

Why does this happen?

When your image has an alpha channel, then the color channel must be pure colors, NOT blended with the background color. They have to be totally independent. But 3Ds Max thinks in a different way: they always use pre-multiplied alpha channels and make things difficult for those that want to composite images outside of Max. (Tested with all versions until Max 2014. Later versions I don’t know about yet, but I bet is still there.)

Solution 1 – EXR or TGA

Use another file format, like OpenEXR or TGA. Yes, it solves the problem, but I want to use .PNG. it’s small, popular and sexy.

Solution 2 – Photoshop

With photoshop, fix “Remove White|Black Matte”. It works perfectly well fixing the mixed RGB channels.
Go to Layer > Matting > Remove White|Black Matte 

Done! But I’m not fully happy yet. I need to fix a whole animation sequence of many PNG images.
Ok. Create a new Photoshop action that applies “Remove White|Black Matte”.  Go to Files > Scripts > Image processor and apply your new action to a whole folder of *.PNG images!
Great!
Wait… No.
I’m using Photoshop CS4 (I’m a vintage guy) and the Image Processor doesn’t have a save to .PNG option! Grrrrr…. Google time.
Yay! Found a modified script of Image Processor that adds PNG-24 support.
(NOTE: At the moment of writing this post, the old links for the scrips are broken. So I going to share my copy of the script here. Copy and replace the old one here: C:Program FilesAdobeAdobe Photoshop CS4 (64 Bit)PresetsScripts )

Well, I was happy for a while, but now I needed more speed, because Photoshop is too slow doing this, and you have to wait for it to process all images to use Photoshop again.

Solution 3 – ImageMagic convert to PNG

UPDATE: This one resulted to be more reliable when I found cases that my final solution 4 failed.

ImageMagick! I was already using ImageMagick tools for a while and now wanted to find a solution to my dirty PNGs.
– Install the command line tools.
– On 3Ds Max render output as TGA.
–  Disable “premultiplied alpha” in TGA setup dialog.
–  Set the background to black (0,0,0)
– Then convert to PNG using ImageMagic convert for single files

convert image1.tga image2.png

– or mogrify for multiple files preserving the file name

mogrify -format png *.tga

Solution 4 – My own matte removal

I have my own graphics Unit developed over many years since Delphi 7 that makes many small efficient useful things by playing with pixels directly.

So now with Delphi XE3 that supports the Load/Saving of PNGs, I made this console tool that fixes my PNGs 10 times faster than Photoshop just with this line in the Windows cmd:
                                    
dpxtool fixalpha *.png black   
                                    
And it works. 😀

You can download the *.EXE and Delphi source here: [Download dpxTool]
Copy it anywhere and add to your Windows PATH environment variable.
If your PNG background is white just omit the color:
dpxtool fixalpha *.png
Use wildcards:
dpxtool fixalpha frame????.png

Tell me in the comments if any of these solutions work for you, or if you have a better one! 😉

Original Images (Right-click to download  PNG):

Image rendered with 3ds Max 2014. See how it shows the black borders on your browser:

This is the image result after fixing with dpxTool. Now it is blending nicely with the white background: