Write a material file with proper alpha using texture's alpha channel

51 Views Asked by At

I'm writing a program in C# to write materials for models I want to export:

mtlfs.WriteLine($"newmtl mtl_{id}");
mtlfs.WriteLine("Ns 1000");
mtlfs.WriteLine("Ka 1.000000 1.000000 1.000000");
mtlfs.WriteLine("Ks 0.000000 0.000000 0.000000");
mtlfs.WriteLine("Kd 1.000000 1.000000 1.000000");
mtlfs.WriteLine("Ni 1.000000");
mtlfs.WriteLine("d 1.000000");
mtlfs.WriteLine("illum 2");
mtlfs.WriteLine("map_Kd " + id + ".png");
mtlfs.WriteLine("map_d " + id + ".png");
        

In documentation I did not find what I was looking for. How can I can make my textures from this:

default

To this:

transparency manually added

I replaced mtlfs.WriteLine("map_d " + id + ".png"); by mtlfs.WriteLine("map_Ka " + id + ".png"); but it did not work either.

0

There are 0 best solutions below