In this example we will be using a flat leaf model textured with a PNG diffuse map which contains alpha channel, and a black and white opacity map.
The objects which are close to the camera appear with small outlines:
After moving the objects farther away from the camera, the material becomes brighter, or washed out:
Although this issue might suggest some problems with the opacity map, it is actually related to the diffuse map. If you are using a bitmap which contains alpha channel information (.png, .tif,...) in diffuse slot, filtering will slightly blur its borders so that the Corona material's solid diffuse color will be visible. Diffuse color is set to gray by default, and this is the reason why in most cases the textures become washed-out or brighter than expected.
Note: this issue is not Corona-related, the same problem would occur in any other renderer.
The effect is barely visible in the material editor if diffuse color is set to default 128 gray:
However, after changing the color to red, it becomes more obvious:
And after disabling transparency for the material, you can see that the solid diffuse color is used in alpha-mapped areas of the texture:
To fix this behavior:
- If the diffuse bitmap contains alpha channel, set the material's diffuse color to correspond to the texture (example: green if it's a leaf texture)
- If the diffuse bitmap does not contain alpha channel, edit it and paint its "background" (the area which is transparent in this picture) with the color corresponding to the main texture
Wrong diffuse bitmap:
Corrected diffuse bitmap:
[ textures by Ludvík Koutný - feel free to download and use them in commercial projects ]
Fixed material seen from a distance (compare with the example at the top of the page):
There are other solutions, but they are not guaranteed to work, and may produce unwanted results like flickering or aliasing, especially in animations:
- Set "blur" parameter to 0 in the diffuse bitmap's settings
- Set "texmap filtering" to "none" in the Development / Experimental Stuff rollout
Related forum thread: https://corona-renderer.com/forum/index.php/topic,9130.msg59044/topicseen.html#new