[SOLVED] Rhino > OBJ > Octane with many material nodes

Forums: [SOLVED] Rhino > OBJ > Octane with many material nodes
Rhino 3D (Export script developed by SamPage; Integrated Plugin developed by Paul Kinnane)

Moderator: face_off

[SOLVED] Rhino > OBJ > Octane with many material nodes

Postby tom_holly » Thu Mar 24, 2011 7:59 am

tom_holly Thu Mar 24, 2011 7:59 am
Hello,

For myself at least I have solved the problem of multiple duplicated material nodes appearing in octane when exporting from Rhino.

I am using Rhino V4 SR9 32 bit on Vista X64, so this solution may or may not work on your setup. Yes, I know I could use Rhino V5, but the texture mapping does not work well with imported V4 files, and at the moment I'm working on a lot of V4 files.

I'm using the OBJ exporter from here: http://wiki.mcneel.com/labs/objio (it may or may not work with the default obj exporter, not tried it)

Lets assume we have 9 cubes, where 3 have a material called 'Stone', 3 called 'Plastic' and the last 3 called 'Wood'.

Depening on how you assign materials in Rhino, it is critical that you assign a material name to each and every object. I tend to put different materials on different layers. This way you can right click on the layer name choose 'Select Objects' and either assign a material created in the material editor (use command MaterialEditor) in which called the material will be assigned as a plugin, or you can manually type in a material name and changed its properties under Basic.

Image

When you're done, export as obj with the setting below... the rest of this assumes you called the exported file cubes.obj

Image

The reason we get the multiple material nodes in octane is that in the cubes.mtl created by the exporter, that a material definition is created for each object, so we get 3 x Stone, 3 x Plastic, 3 x Wood etc as is shown below.
Code: Select all
# Rhino
newmtl Wood
Ka 0.0000 0.0000 0.0000
Kd 0.3098 1.0000 0.4667
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
d 1.0000
Ns 0

newmtl Wood
Ka 0.0000 0.0000 0.0000
Kd 0.3098 1.0000 0.4667
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
d 1.0000
Ns 0

newmtl Wood
Ka 0.0000 0.0000 0.0000
Kd 0.3098 1.0000 0.4667
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
d 1.0000
Ns 0

newmtl Plastic
Ka 0.0000 0.0000 0.0000
Kd 1.0000 0.7765 0.3098
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
d 1.0000
Ns 0

newmtl Plastic
Ka 0.0000 0.0000 0.0000
Kd 1.0000 0.7765 0.3098
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
d 1.0000
Ns 0

newmtl Plastic
Ka 0.0000 0.0000 0.0000
Kd 1.0000 0.7765 0.3098
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
d 1.0000
Ns 0

newmtl Stone
Ka 0.0000 0.0000 0.0000
Kd 1.0000 0.3098 0.1569
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
d 1.0000
Ns 0

newmtl Stone
Ka 0.0000 0.0000 0.0000
Kd 1.0000 0.3098 0.1569
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
d 1.0000
Ns 0

newmtl Stone
Ka 0.0000 0.0000 0.0000
Kd 1.0000 0.3098 0.1569
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
d 1.0000
Ns 0


When we import cubes.obj into octane, we get this:

Image

The way around this is to ensure in the cubes.mtl file that it shows only unique material definitions.

I'm sure there is a way to automate this, but at the moment I haven't had the time to work out how to do it quickly.

I have sorted it with using a spreadsheet (LibreOffice Calc), if anyone is interested, let me know and I can post how I do it in a spreadsheet...

You end up with this:
# Rhino
newmtl Wood
Ka 0.0000 0.0000 0.0000
Kd 0.3098 1.0000 0.4667
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
d 1.0000
Ns 0

newmtl Plastic
Ka 0.0000 0.0000 0.0000
Kd 1.0000 0.7765 0.3098
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
d 1.0000
Ns 0

newmtl Stone
Ka 0.0000 0.0000 0.0000
Kd 1.0000 0.3098 0.1569
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
d 1.0000
Ns 0


Saving the above to cubes.mtl and importing in Octane, we now get this:

Image

Before sorting the .mtl files problem, I used to export from Rhino > Blender > Octane but this is another process and I also lost smooth materials and other probs as are mentioned elsewhere in the forum.

2 things that could be done:

Refractive Software: Provide an option on import or in preferences to ignore duplicate material definitions in the .mtl file
McNeel: Provide an option on export not to export duplicated material definitions

Hope this helps.
AMD Athlon(tm) II X4 640 @ 3.0 HGz | 4.00 GB | Octane beta 2.44 | Rhino V4 SR9 | Windows Vista x64 | GTX 570
tom_holly
Licensed Customer
Licensed Customer
 
Posts: 24
Joined: Thu Feb 24, 2011 2:41 pm

Re: [SOLVED] Rhino > OBJ > Octane with many material nodes

Postby Daniel79 » Sun Apr 17, 2011 10:28 pm

Daniel79 Sun Apr 17, 2011 10:28 pm
I solved at moment the problem of exporter...(the problem of multiple duplicated material nodes appearing in octane when exporting from Rhino)
This is th trick to export from rhino to octane:
1) Create and mapping your model
2) Apply material definition everyone whit our name (es.wood,wall,grass.....)
3) Select in your model the polysurface or surface by material
4) Trasform this in mesh and join it
5) Hide old Polysurface or surface for future changes
6) Repeat for all materials (groups of object)
7) Export whit exporter
8) Have a good render!!!

I add exemple whit a lot of poligons (see the roof, there are a lot of object!!) but not a multiple duplicated material nodes!!!!!
Attachments
SOLVED.jpg
SORRY, MY ENGLISH IS BAD!
2 Xeon quad core E5440_8gb Ram_Nvidia GeForce 2GTX 780ti 3Gb/Nvidia Quadro K2000_Win10 64bit_Octane 3.02_Rhinoceros3D
User avatar
Daniel79
Licensed Customer
Licensed Customer
 
Posts: 451
Joined: Tue Jan 26, 2010 3:53 pm
Location: Italy

Re: [SOLVED] Rhino > OBJ > Octane with many material nodes

Postby MasterLuke » Sat Jun 04, 2011 10:21 am

MasterLuke Sat Jun 04, 2011 10:21 am
Just noticed and adding to instruction:
If Rhino is running a language (e.g.german) where decimal place is divided by a comma, export won't work because camera position isn't parsed correctly.
At least in my installation ;)

greetz
MasterLuke
i7 920 | 6 GB | GTX260 (Calibre x265) 896 MB | WIN7 64Bit
User avatar
MasterLuke
Licensed Customer
Licensed Customer
 
Posts: 2
Joined: Sat Mar 13, 2010 1:48 pm

Re: [SOLVED] Rhino > OBJ > Octane with many material nodes

Postby tom_holly » Thu Jun 23, 2011 12:30 pm

tom_holly Thu Jun 23, 2011 12:30 pm
I've uploaded a script to remove and sort the duplicate materials in MTL files when exporting OBJ files from Rhino 3D.

It works for Rhino 4. It may or may not work for other versions.

This is not fully tested, so use at your own risk.

You may post any bugs to me here: http://www.refractivesoftware.com/forum/viewtopic.php?f=41&t=7044

http://rhino-3d-obj-mtl-fix.zzl.org/

Cheers, Tom
AMD Athlon(tm) II X4 640 @ 3.0 HGz | 4.00 GB | Octane beta 2.44 | Rhino V4 SR9 | Windows Vista x64 | GTX 570
tom_holly
Licensed Customer
Licensed Customer
 
Posts: 24
Joined: Thu Feb 24, 2011 2:41 pm

Return to Rhinoceros 3D


Who is online

Users browsing this forum: No registered users and 25 guests

Fri Apr 26, 2024 2:29 am [ UTC ]