Conversion of obj files

Hello all,

I am a new user of Radiance and have been working through the manual, examples, list-server...

I am working to convert a .obj and .obj.mtl file created in CATIA for use in Radiance.

My understanding is as follows...

Convert the .obj file to .rad using OBJ2RAD, using a map file that can be created with the help of the -n qualifier. Its not clear to me that I really need the .map file, based on this comment "The material names for the surfaces will assigned based on the mapping rules file given in the −m option. If no mapping file is given, the identifiers given by the "usemtl" statements will be used as the material names." Looking at the .obj file, it uses usemtl statements, which is why I don't necessarily think I need the .map? Sample from the .obj is below:

mtllib light.obj.mtl
s off
v -0.279400 -0.006350 0.076200
v -0.279400 -0.006350 0.003175
v 0.482600 -0.006350 0.076200
v 0.482600 -0.006350 0.003175
vn 0.000000 -1.000000 -0.000000
vn 0.000000 -1.000000 -0.000000
usemtl appearance0
g default
f 1//1 2//1 3//1
f 3//2 2//2 4//2

Next I believe I need to convert the .obj.mtl file to a material .rad file. I found this comment
http://www.radiance-online.org/pipermail/radiance-general/2003-May/000727.html

indicating there is not a direct translator. So, I believe I need to do this manually? Here is an example from the .obj.mtl file:

newmtl appearance0
Ka 0.793125 0.793125 0.793125
Kd 0.793125 0.793125 0.793125
Ks 0.119 0.119 0.119
Ns 119.04
d 1
illum 2

If this is the case, my next step would be to dig into both material descriptions. Any past experience would be appreciated!

One other question, is there a better output format than .obj that incorporates the material properties, or maybe I should be asking, has a more direct correlation between the material properties? I have a feeling its not that easy!

Thank you,

Brian

Hi Brian,

Good research! The materials do not translate very well, so you'll just have to do the best you can with those. If your object(s) have mapped textures, you may be better off using obj2mesh instead of obj2rad, since a Radiance triangle mesh supports mapped textures. You'll still need to translate the texture image file(s), however.

Best,
-Greg

···

From: Brian A Karr <[email protected]>
Date: December 21, 2013 4:42:10 PM PST

Hello all,

I am a new user of Radiance and have been working through the manual, examples, list-server...

I am working to convert a .obj and .obj.mtl file created in CATIA for use in Radiance.

My understanding is as follows...

Convert the .obj file to .rad using OBJ2RAD, using a map file that can be created with the help of the -n qualifier. Its not clear to me that I really need the .map file, based on this comment "The material names for the surfaces will assigned based on the mapping rules file given in the −m option. If no mapping file is given, the identifiers given by the "usemtl" statements will be used as the material names." Looking at the .obj file, it uses usemtl statements, which is why I don't necessarily think I need the .map? Sample from the .obj is below:

mtllib light.obj.mtl
s off
v -0.279400 -0.006350 0.076200
v -0.279400 -0.006350 0.003175
v 0.482600 -0.006350 0.076200
v 0.482600 -0.006350 0.003175
vn 0.000000 -1.000000 -0.000000
vn 0.000000 -1.000000 -0.000000
usemtl appearance0
g default
f 1//1 2//1 3//1
f 3//2 2//2 4//2

Next I believe I need to convert the .obj.mtl file to a material .rad file. I found this comment
http://www.radiance-online.org/pipermail/radiance-general/2003-May/000727.html

indicating there is not a direct translator. So, I believe I need to do this manually? Here is an example from the .obj.mtl file:

newmtl appearance0
Ka 0.793125 0.793125 0.793125
Kd 0.793125 0.793125 0.793125
Ks 0.119 0.119 0.119
Ns 119.04
d 1
illum 2

If this is the case, my next step would be to dig into both material descriptions. Any past experience would be appreciated!

One other question, is there a better output format than .obj that incorporates the material properties, or maybe I should be asking, has a more direct correlation between the material properties? I have a feeling its not that easy!

Thank you,

Brian

Hello Brian,

A quick check of http://www.fileformat.info/format/material provides some information on the file format which could be used as a guide.

Using your {mtl} file:
newmtl appearance0
Ka 0.793125 0.793125 0.793125
Kd 0.793125 0.793125 0.793125
Ks 0.119 0.119 0.119
Ns 119.04
d 1
illum 2

To list all materials in the mtl file listing all line containing the newmtl string:
     grep newmtl {mtl}

     In your case the first materials name is appearance0
     According to http://www.fileformat.info/format/material:
         The Ka statement specifies the ambient reflectivity using RGB values.

"r g b" are the values for the red, green, and blue components of the color. The g and b arguments are optional. If only r is specified, then g, and b are assumed to be equal to r. The r g b values are normally in the range of 0.0 to 1.0. Values outside this range increase or decrease the reflectivity accordingly.

         The Kd statement specifies the diffuse reflectivity using RGB values.
         The Ks statement specifies the specular reflectivity using RGB values.

Therefore a simple material definition for your appearance0 might be:
void plastic appearance0
0
5 0.793125 0.793125 0.793125 .1 .1

The last two parameters (.1 and .1) are the specularity and roughness. Specularity fractions greater than 0.1 and roughness values greater than 0.2 are not very realistic.

*Terrance McMinn

···

***

Thanks all. Ill spend some time looking at the material format versus the
radiance definitions. For now Terrance's suggestion will work. I created a
materials.rad file with the definitions.

I had some trouble with missing source auxiliary files, but have added them
in. I must have made a mistake during the installation.

So I have inserted my sample Catia object with materials.rad description
into the red ball/light example.

Brian

···

From: Terrance McMinn [mailto:[email protected]]
Sent: Monday, December 23, 2013 2:44 AM
To: Brian A Karr; Radiance general discussion
Subject: Re: [Radiance-general] Conversion of obj files

Hello Brian,

A quick check of http://www.fileformat.info/format/material provides some
information on the file format which could be used as a guide.

Using your {mtl} file:
newmtl appearance0
Ka 0.793125 0.793125 0.793125
Kd 0.793125 0.793125 0.793125
Ks 0.119 0.119 0.119
Ns 119.04
d 1
illum 2

To list all materials in the mtl file listing all line containing the newmtl
string:
    grep newmtl {mtl}
    
    In your case the first materials name is appearance0
    According to http://www.fileformat.info/format/material:
        The Ka statement specifies the ambient reflectivity using RGB
values.

"r g b" are the values for the red, green, and blue components of the color.
The g and b arguments are optional. If only r is specified, then g, and b
are assumed to be equal to r. The r g b values are normally in the range of
0.0 to 1.0. Values outside this range increase or decrease the reflectivity
accordingly.

        The Kd statement specifies the diffuse reflectivity using RGB
values.
        The Ks statement specifies the specular reflectivity using RGB
values.

Therefore a simple material definition for your appearance0 might be:
void plastic appearance0
0
0
5 0.793125 0.793125 0.793125 .1 .1

The last two parameters (.1 and .1) are the specularity and roughness.
Specularity fractions greater than 0.1 and roughness values greater than 0.2
are not very realistic.

Terrance McMinn