Page 1 of 1
Importing obj file with transparent material
Posted: Sun Dec 04, 2011 9:51 am
by objo
I am making an open source exporter (.net/WPF) that creates obj files for import in Octane.
Diffuse materials and geometry works great, but I don't get Octane to import the specular components and opacity of my simple materials.
Here is an example I would expect to show two diffuse/specular/transparent planes:
test1.mtl
Code: Select all
newmtl PlaneMaterial
Kd 1.0 0.0 0.0
Ks 0.4 0.4 0.4
d 0.5
illum 2
test1.obj
Code: Select all
mtllib test1.mtl
o Planes
v 1 0 -1
v 1 0 1
v -1 0 1
v -1 0 -1
v 1 0.1 -1
v 1 0.1 1
v -1 0.1 1
v -1 0.1 -1
vn 0 1 0
usemtl PlaneMaterial
s off
f 1//1 4//1 3//1 2//1
f 5//1 8//1 7//1 6//1
Is something wrong here?
I use default OBJ mesh import preferences, both "Diffuse" and "Specular" material types are checked.
I have tried using both "Tr" and "d" in the mtl file.
Re: Importing obj file with transparent material
Posted: Sun Dec 04, 2011 11:18 am
by face
Diffuse: Specular Decay = 0 or Specular Color = black
Specular: Index Of Refraction > 1 and Transparancy Color > black
Glossy: All other possible options
hope this helps...
face
Re: Importing obj file with transparent material
Posted: Sun Dec 04, 2011 11:47 am
by t_3
... here is a working example (glossy), including bump & opacity maps:
Plane.obj:
Code: Select all
mtllib Plane.mtl
o Plane
v 0 0 1
v 1 0 1
v 0 0 0
v 1 0 0
vt 0 0
vt 1 0
vt 0 1
vt 1 1
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
g Plane
usemtl Default
f 1/1/1 2/2/2 4/4/4 3/3/3
Plane.mtl:
Code: Select all
newmtl Default
Ns 1
Kd 1 0 0
Ks 0 0 1
Km 1
map_D /Maps/dummy.jpg
map_Bump /Maps/dummy.jpg
and another .mtl for specular:
Plane.mtl:
Code: Select all
newmtl Default
Ns 1
Ni 2
Kd 1 0 0
Ks 0 0 1
or in other words, you're missing the "Ni" - index of refraction - and opacity only works through an applied map (but i'm maybe wrong here)...
Re: Importing obj file with transparent material
Posted: Sun Dec 04, 2011 7:16 pm
by Tugpsx
nice find
Re: Importing obj file with transparent material
Posted: Mon Dec 05, 2011 6:52 pm
by objo
Thanks for your replies!!
I have specular materials working now, but still have problems with opacity.
Specular materials: I see there is a difference when I specify Ni or not:
if I specify Ni, I get a specular material with Reflection (Ks) and Transmission (Kd) components.
if I do not specify Ni, I get a glossy material with Diffuse (Kd) and Specular (Ks) components.
Opacity: I also tried setting the dissolve map (map_D), but can't get this imported. There is also no effect of the dissolve parameter (d). The "Texture types|opacity (d)" is checked under preferences. Diffuse and bump maps are imported ok. Are there any other parameter I have to set?
The following is from the obj spec
map_d -options args filename
Specifies that a scalar texture file or scalar procedural texture file
is linked to the dissolve of the material. During rendering, the map_d
value is multiplied by the d value.
"filename" is the name of a scalar texture file (.mps), a scalar
procedural texture file (.cxs), or an image file.
The options for the map_d statement are listed below. These options
are described in detail in "Options for texture map statements" on page
5-18.
-blendu on | off
-blendv on | off
-clamp on | off
-imfchan r | g | b | m | l | z
-mm base gain
-o u v w
-s u v w
-t u v w
-texres value
and
d factor
Specifies the dissolve for the current material.
"factor" is the amount this material dissolves into the background. A
factor of 1.0 is fully opaque. This is the default when a new material
is created. A factor of 0.0 is fully dissolved (completely
transparent).
Unlike a real transparent material, the dissolve does not depend upon
material thickness nor does it have any spectral character. Dissolve
works on all illumination models.
t_3: Thanks for your examples! I don't get the dissolve map to import, does it work on your machine?
(I am using 1.0beta 2.46b demo)
Re: Importing obj file with transparent material
Posted: Mon Dec 05, 2011 7:32 pm
by t_3
the examples work here - with 2.55b; could, be that it really is different to 2.46. i remember, that around 2.49 the import was corrected, so that "map_d" and "map_D" would work, so maybe opacity import was not working at all (earlier).
the "d" is completely ignored, but i don't know why (haven't missed it that much though)...
Re: Importing obj file with transparent material
Posted: Tue Dec 06, 2011 6:55 pm
by objo
ok, that makes a good reason to upgrade to the full version

I hope support for the "d" value can be implemented soon!
Re: Importing obj file with transparent material
Posted: Tue Dec 06, 2011 9:04 pm
by t_3
objo wrote:ok, that makes a good reason to upgrade to the full version

I hope support for the "d" value can be implemented soon!
this seems to be the most uncommon reason ever to buy octane

but as you get pmc, sss & speed improvements as well, you won't regret it imo...