Planetside Software Forums

Support => Terragen Support => Topic started by: D.A. Bentley (SuddenPlanet) on January 25, 2010, 05:51:27 PM

Title: MTL File Specification for OBJ Import in TG2
Post by: D.A. Bentley (SuddenPlanet) on January 25, 2010, 05:51:27 PM
I am having trouble with one aspect of Importing an OBJ object with an MTL material definition file (Image Alpha).  I can successfully import an OBJ object with 4 materials, but the two materials that have an Alpha map require an extra step to connect the Alpha map to the Shader.  What I am wondering is if Terragen 2 is capable of reading Alpha Map information in a MTL file and automatically assigning the correct map to the Opacity Map slot in the appropriate Defualt Shader.  Otherwise I just manually browse for the alpha map after the import has been done.

I don't mind doing manual editing of the MTL file, I just need to knwo what Terragen 2 is looking for when it comes to Alpha Maps.  Below is an example of the MTL file I am using right now:

newmtl Material_001
Ns 10
Ka 0.5882353 0.5882353 0.5882353
Kd 0.5882353 0.5882353 0.5882353
Ks 0 0 0
map_Kd Texture-Diff-01.tif
d 1

newmtl Material_002
Ns 10
Ka 0.5882353 0.5882353 0.5882353
Kd 0.5882353 0.5882353 0.5882353
Ks 0 0 0
map_Kd Texture-Diff-02.tif
d 1

newmtl Material_003
map_d Alpha01.tif
Ns 10
Ka 0.5882353 0.5882353 0.5882353
Kd 0.5882353 0.5882353 0.5882353
Ks 0 0 0
map_Kd Texture-Diff-01.tif
d 1

newmtl Material_004
map_d Alpha02.tif
Ns 10
Ka 0.5882353 0.5882353 0.5882353
Kd 0.5882353 0.5882353 0.5882353
Ks 0 0 0
map_Kd Texture-Diff-02.tif
d 1

I am using the map_d to specify the Alpha/Opacity Map, but it doesn't seem to be recognized by the TG2 OBJ importer.
Title: Re: MTL File Specification for OBJ Import in TG2
Post by: Matt on January 26, 2010, 11:21:25 PM
map_d isn't currently supported by Terragen's OBJ Reader.

I wrote something about how it automatically uses the alpha channel in the diffuse map as opacity, but that only works for a very particular set of conditions in some Xfrog files. It doesn't work in general.

Matt
Title: Re: MTL File Specification for OBJ Import in TG2
Post by: D.A. Bentley (SuddenPlanet) on January 27, 2010, 02:14:32 AM
Thanks Matt.  I did find someone on "Terragen.org and the Ashundar Terragen Community" who provided me with an AutoIt script that converts a MTL file into a Terragen 2 Clip file.  I tested the .exe version of the script on my test MTL file and it did what I was hoping for. 

Here is the thread:

http://www.terragen.org/index.php?topic=4828.new#new