Featured post

new redirect for blender.org bpy docs.

http://www.blender.org/api/blender_python_api_current/ As of 10/11 november 2015 we can now link to the current api docs and not be worr...

April 16, 2012

three.js and blender

Time for a new post.

All you need is the blender 2.x exporter available here github mrdoob. Then download the (customized) boilerplate here (the save button didn't work in my version of chrome but firefox was fine)

After leeching the boilerplate code, I removed the stats and other typography and looked at the examples on http://mrdoob.github.com/three.js/ and saw the walt disney head, and stared at the underlying code for a while and noticed code that resembled the expected geometry loading.
loader = new THREE.JSONLoader();
loader.load( 'obj/suzi.js', function ( geometry ) {
 var mesh = new THREE.Mesh(geometry, new THREE.MeshNormalMaterial({overdraw: true}));
 scene.add( mesh );
This suggested it would be easy to simply export suzanna from blender using the export script and stick it into a small html file. It was. It's a little sluggish on my slow machine with power saving switched on - but that's not three.js' fault.

However, there is more!

The following links may or may not work on your computer, if you know why that is then drop me a line.

This hasselblad projection painted model was done a while back and I never got around to really finishing the texture. The html/js still throws a small error, which is probably easy to crush, but the scene renders OK in Chrome. A Stackoverflow post gives slightly different code, but it helped figure out how to pack the texture into the material. Now I should really get comfy with the rotation code and tame this sucker.

Here is a version of the texture with wireframe to show the underlying quad geometry. Or this one, it's with tamed rotation


original image obtained from: mrmartinweb.com, permission to use the image is pending

How to projection paint

Best watch this video by the guy that coded the projection painting features, you will need no other introduction