Transparency in .MTL file (exported from 3dsmax)

Heya!

I’m exporting an .obj from 3dsmax and am trying to import it in the jMP. I’ve been puzzling for a long time why i wasn’t seeing anything until i found out this has something to do with the Transparency settings.

When exported from 3dsmax my .MTL looks like this:

[xml]# 3ds Max Wavefront OBJ Exporter v0.97b - ©2007 guruware

File Created: 26.07.2011 15:15:00

newmtl House1

Ns 127.0000

Ni 1.5000

d 1.0000

Tr 0.0000

Tf 1.0000 1.0000 1.0000

illum 2

Ka 0.8000 0.8000 0.8000

Kd 0.8000 0.8000 0.8000

Ks 0.4500 0.4500 0.4500

Ke 0.0000 0.0000 0.0000[/xml]

If i’m correct, the tags interpreted for transparency by jMP are both the “d” and the “Tr” tag. When the “Tr” tag is 0, the model is entirely transparent.

This is rather strange. When i lower to the opacity in 3dsmax to say 80, the “d” value drops to 0.8000 and the “Tr” value changes to 0.2000.

(Screenshot 3dsmax)



[xml]# 3ds Max Wavefront OBJ Exporter v0.97b - ©2007 guruware

File Created: 26.07.2011 16:24:40


newmtl House1
Ns 127.0000
Ni 1.5000
d 0.8000
Tr 0.2000
Tf 0.8000 0.8000 0.8000
illum 2
Ka 0.8000 0.8000 0.8000
Kd 0.8000 0.8000 0.8000
Ks 0.4500 0.4500 0.4500
Ke 0.0000 0.0000 0.0000[/xml]

It looks like those values combined should be 1.0, instead of depending entirely on the "Tr" as the transparency.
Anyone cares to share some insight on this subject?
Thanks in advance!

See this:

MTL Files - Material Definitions for OBJ Files


d alpha
defines the transparency of the material to be alpha. The default is 1.0 (not transparent at all) Some formats use Tr instead of d;
Tr alpha
defines the transparency of the material to be alpha. The default is 1.0 (not transparent at all). Some formats use d instead of Tr;


It seems that the exporter you're using is beta version (0.97) perhaps you can update to stable release version?

Raise Dead Thread !

Got hit by same problem. There is a a bug in ObjLoader - it checks if d/tr is != 0 to make object transparent. Instead it should be

 float tempAlpha = scan.nextFloat();
            if (tempAlpha != 1.0){
                alpha = tempAlpha;
                transparent = true;
            }

unfortunately, then you are hit by d 1.0 tr 0.0 problem in some of the models. I would probably suggest taking max of d and tr values if both appear in model, just to stay on safer side in case obj file is broken.

In any case, change above is needed - otherwise, everything is transparent/alpha blend, which causes visual artifacts in some scenes.

And as extra hint. If you are loading sponza obj model, make sure you got to mtl file and change

	map_Ka textures\spnza_bricks_a_diff.tga
	map_Kd textures\spnza_bricks_a_diff.tga
	map_bump textures\spnza_bricks_a_diff.tga
	bump textures\spnza_bricks_a_diff.tga

to

	map_Ka textures\spnza_bricks_a_diff.tga
	map_Kd textures\spnza_bricks_a_diff.tga
	map_bump textures\spnza_bricks_a_ddn.tga
	bump textures\spnza_bricks_a_ddn.tga

Caused me to lose few hours debugging my tbn matrix…