I have been working on a texture for an avatar to put in VRChat using Blender and Krita.The texture looks completely fine when in Blender but when I import the PNGs to Unity, issues occur. The main body texture appears on the avatar just fine, but the PNG I am using for emission imports with dots and splotches that are NOT on the original PNG. dwdIt appears that Unity is remembering some kind of data that is no longer present in the PNG.
What it SHOULD look like shown in Blender
The exported PNG showing no extra spots/splotches
I re-exported the PNG from the Krita file a few times, to no avail. I made sure the file was deleted completely from Unity and also from where I had it saved in the folder. I even restarted my computer to see if that fixed it but it did not. To test my theory on Unity remembering data, I added a blue spot in the texture, exported it as a PNG. Then I erased that blue spot in Krita and re-exported it as a second PNG. I took this second PNG and exported it into Unity. The preview of the texture in the inspector showed the blue spot I had added and the spots and splotches were also still present that had been erased a while ago.
Comparison of PNG and it’s imported version in Unity
What it looks like on the avatar in Unity 1
What it looks like on the avatar in Unity 2
Cepheron Kalle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
This is usually not an issue in Unity but the program you use to edit the png file. Depending on what you mean by “erase”, most editing programs just set the alpha channel to 0 but leave the color channels intact. Different programs behave differently and have different tools to deal with that.
We don’t know how you apply those textures inside Unity. If it’s some kind of decal, multiply or additive shader, it may ignore the alpha channel. It’s hard to tell just from seeing images.
Inside Unity the texture preview has those buttons on the top:
With those you can view individual channels so you can see what the actual color channels (R, G, B) contain. Your image editing software may have an option to fill pixels which have an alpha value of 0 with a certain color (you probably want black).
Clearing out the alpha==0 regions is generally a good iead as keeping those will make the image larger than they need to be.
ps: I’m not sure if Unity would actually clear out the fully transparent pixels when you tick the “Alpha is Transparency” checkbox during import. However this probably wouldn’t really work for you as this checkbox deliberately adds color information in the fully transparent pixels around the edges to avoid color bleeding when the alpha channel is used for transparency / alpha blending.
Note that the alpha channel is just another data channel. It doesn’t have to represent transparency. This all comes down to the shader in use.
1
I don’t know anything at all about Unity, blenders or Kritas but am just trying to help by pointing out that images with alpha/transparency (such as PNG) can have all sorts of junk concealed in the alpha channel. I’ll show you a way of removing it too.
So, here is an image of random dots with a transparent hole in the middle:
If, I use ImageMagick to separate the image into Red, Green, Blue and Alpha channels and lay them out across the page with Red on the left, then Green, then Blue and Alpha on the right:
magick image.png -separate +smush 10 channels.png
You can hopefully see that all the random stuff is still there in the transparent hole in the Red, Green and Blue channels, but it is just concealed by the black rectangle in the alpha channel.
Maybe that is what is happening – you can try the magick
command above and see.
Now let’s remove it. Thanks to Fred @fmw42 for the simplified removal method in the comments:
magick image.png -background black -alpha background result.png
If we look at the result image, we see that the random colours are gone and replaced with black in the transparent hole:
magick result.png -separate +smush 10 channels.png
1