Obj for Webgl?

Dear All, I am trying to export an obj file and the reference mtl one for webgl.
I ve tried to do that with my model, but it was so complicated (the size is too big).
Then i try with a simple geometry. A sphere where i ve put a bump.
Unfortunately all the times I’ve generated 2 files that don’t fit to the system.
It says “Cannot read property ‘clone’ of undefined” etc.
I ve tried to export from PC too. But always the same problem.
What is wrong in the exportation phase?? Could you help me?
Do you suggest differente ways of exportation? I need a .stl or .obj.?

I know @fraguada has some experience with this…perhaps he could give some recommendations.

Hello Annalisa,
We would need to know a bit more about the content files you want to export and to which WebGL engine you want to export to. There are a few other things that could be causing errors in the process (material names, etc), but without knowing the 3d content and where you want it to go, it is difficult to help.

Where do you see this, in Rhino or in the WebGL Engine you are trying to use?

Dear all. Thank you for your feedback.

I see the error in the webgl.
I ve made some tests with Three.js http://threejs.org/

The file is a very simple sphere on which i ve put a bump.
I m trying to find the right process with a simple One in order to reproduce It for an another complex geometry.
I export an obj and its file .mtl.
The problem is that WHen my web developer opens the file .mtl in webgl error always comes!

The name of the file is
And the bump is
Of the bump.

Thank you for any help you could vive to me!

Hello Annalisa,
Unfortunately we do not control the development of threejs. Your issue is more than likely with an implementation of threejs rather than the exporting of an obj from Rhino. Does your OBJ open without using the MTL? Have you tried opening the obj in the editor? Here is the documentation for the mtl loader: http://threejs.org/docs/#Reference/Loaders/OBJMTLLoader


Hello Fraguada.
we have followed your suggestions.
Unfortunately it doesn’t work again.
The obj opens ok. But the file .mtl still presents some problems.
I ve seen that the info of the code of the example demo are different form the ones that come from Rhino exportation.
Is there any possibility to manipulate them during the exportation or is it possible to set them in order to have the some result of the example?

This is from rhino exportation


newmtl Material_1
Ka 0.0000 0.0000 0.0000
Kd 1.0000 1.0000 1.0000
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
d 1.0000
Ns 0
map_Kd stock-photo-750629-algae-on-fishtank-ps-layer.jpg
map_Bump stock-photo-750629-algae-on-fishtank-ps-layer.jpg

This is from the demo

Material Count: 5

newmtl 01-Default1noCulli__01-Default1noCulli
Ns 154.901961
Ka 0.000000 0.000000 0.000000
Kd 0.640000 0.640000 0.640000
Ks 0.165000 0.165000 0.165000
Ni 1.000000
d 1.000000
illum 2
map_Kd 01

My best

Hello @annalisa,
Maybe you should take a look at Iris. While it does not solve your issue directly, it is a WebGL exporter for Rhino.

As for the obj file mtl export, I am not sure what the issue could be since it cannot be guaranteed to know where the obj was created. If you open it in Rhino, and it has the materials linked properly, and you get different results, then the issue would be in the Rhino obj exporter or the three.js mtl importer.

I just opened Rhino for Mac, made a few boxes, applied material and box texture mapping. Then I changed the webgl_loader_obj_mtl.html file to point to my obj file and mtl file.

While I notice that the texture mapping might not match up (the navigation of this example is a bit strange), all I did was change the code to point to my new .obj and .mtl.

All the best,

Dear Luis,

Thank you.
But I dont’ understand…Does it work in this way (by changing the html file)?
From the screenshot it seems there is not correspondance between the source file in Rhino and the one in Webgl.
isn’t it?

However i will try “iris” too.
Thank you

my best

Iris is a file export plugin. The screenshot shows mesh in ‘shaded’ mode in rhino. Thus you see the wireframe edges. In the browser, you see it rendered in WebGL. It might make a better screenshot if in Rhino he model was presented in ‘rendered’ mode.

Let me know if you need any support in getting Iris to work for you.


Dear Fraguda,

Is the plug in ok for Mac?
I am trying to install it but I ve some troubles…

ThankS in advance


There is no mac version available at the moment, so the plugins will not work. If you are interested, send me an email and I can give you access to the mac version for testing.

Another possibility is a web service called Clara IO at:

One of the export formats is the ThreeJS JSON format. Since it was made specifically for ThreeJS it is most likely to work without issue. This does mean you will have to use a different loader for your objects.

Hope this helps.

x Jeremy M.

Thank you Jeremy.

At the end I ve generated an obj from Blender.
I passed from Rhino to Blender.
Finally the file .mtl (created in this software) has been read by Webgl.

I am still waiting for the best solution to reduce the size of the obj directly from Rhino, during the save time. Not plugin for Mac available at the moment!

I will wait for that!

Thank you for the help.