Reputation: 523
I am scratching my head about this thing: I have simple model of LEGO tile 2x2 brick in OBJ file format in red color that has applied transparent image of yellow arrow to its top surface. It is defined in the mtl file like this (generated with Blender 2.90.1):
newmtl 21
Ns 50.000007
Ka 1.000000 1.000000 1.000000
Kd 0.705882 0.000000 0.000000
Ks 0.700000 0.700000 0.700000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Kd 306808.png
Problem is, that once imported back to Blender (to check if it is made as it should, which it seems is not) or seen in a PoseRay (3D viewer), the brick background color is pitch black (or white in PoseRay) tho the yellow arrow is visible. It seems that it simply ignores the alpha channel of the transparent png image, or am I aright? This is how it looks in PoseRay:
Yet I played with it a bit after spending half a day on internet trying to find the solution (no success tho), and I at least find out that if I change that map_Kd
for map_d
it makes that alpha channel of the transparent png active but it change the image colors (black makes the surface of the brick completely see-thru so we can see into the brick, and the yellow becomes whiteish, as it basically takes black as revealing and white as opaque and everything in between partially visible/invisible depending on where the actual color sits between the black and white). See the code and resulting image below.
newmtl 21
Ns 50.000007
Ka 1.000000 1.000000 1.000000
Kd 0.705882 0.000000 0.000000
Ks 0.700000 0.700000 0.700000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_d 306808.png
So does obj/mtl support alpha channel of the transparent png image defined inside the mtl file? And if it does how to do it (code in mtl file) so that it would look as expected (yellow arrow on red background)?
Upvotes: 3
Views: 594