Server crash and recovery

My previous webserver provider had a major crash and pushed me back to an old backup somewhere around 2011. I’ve been able to recover posts from WordPress App. Fortunately it did not sync with the website so i was able to retrieve most of the information and re-post.

Unfortunately the /portfolio section is lost. No matter, i will build more.

I’ve moved to a new and hopefully better service now, so hopefully we’re back in business.

Planar Reflections & Area Lights

Recently i’ve been experimenting Lagarde’s methods to achieve planar reflections using local probes and billboard reflections. One thing lead to the other and i’ve also wrote some code for area lights (rect, disk & sphere).

Screenshot 2014-11-26 12.56.46

Screenshot 2014-11-26 15.16.41

Screenshot 2014-11-26 14.11.56

Screenshot 2014-11-22 13.12.03

Screenshot 2014-11-26 19.54.53

Video: Cerberus Gun

Modified converter_to_threejs.py

Threejs includes a nice fbx – and other formats – converter script to Threejs’s JSON format, but there was some issues and improvements i felt the need for, so i’ve created a modified version of it.

This modified version includes the following changes:

  • Map AmbientColor texture slot to Three.js LightMap
  • Material map filenames only, full path removed
  • New console arg “-b” used to override MeshLambertMaterial by MeshBasicMaterial
  • Creates a local “/maps” folder next to .js file and save all textures to it

First thing i’ve noticed was there in no way to get lightmaps to work when using Maya, so i had to have a slot that did just that. Also when adding textures to materials the script would always fail when attempting to copy textures, because the source would try to copy into itself. Not sure why it was made like that, but it didn’t work for me. Copying the textures into a local folder was a need as i want things relative to my project root.

You can find the modified script here: GIST

Rendering partial Geometry in Three.js

Update: I was told by Mr.Doob that it is possible to render partial geometry using offsets/drawcalls, therefore no need to change the library. There is a catch.. It only works for indexed geometry, which in my specific case would not do the trick, still it is good to know there is such an option.


One thing i’ve missed when using Threejs was the possibility to render a set of a Geometry. In my case a large BufferGeometry pool.

Setting up one was quite easy:

// Non-indexed geometry data
var numVertices = 1024 * 10;
cubePoolGeometry.addAttribute( "position", new THREE.Float32Attribute( numVertices, 3 ) );
cubePoolGeometry.addAttribute( "color", new THREE.Float32Attribute( numVertices, 3 ) );
cubePoolGeometry.addAttribute( "uv", new THREE.Float32Attribute( numVertices, 2 ) );
cubePoolGeometry.addAttribute( "normal", new THREE.Float32Attribute( numVertices, 3 ) );

When rendering the geometry it will internally use the size of the buffer, being the total length allocated at init time. Internal code shows exactly that:

_gl.drawArrays( _gl.TRIANGLES, 0, position.array.length / 3 );
_this.info.render.vertices += position.array.length / 3;
_this.info.render.faces += position.array.length / 9;

This will always render the full batch, which i did not want. The change was easy and could be a good thing for future releases of the library:

_gl.drawArrays( _gl.TRIANGLES, 0, position.numItems / 3 );
_this.info.render.vertices += position.numItems / 3;
_this.info.render.faces += position.numItems / 9;

This allows to render a subset of the geometry by changing the attribute variable numItems, like so:

// Render only first 20%
var numVertices = 1024 * 2;
cubePoolGeometry.attributes.position.numItems = numVertices * 3;
//cubePoolGeometry.attributes.color.numItems = numVertices * 3;
//cubePoolGeometry.attributes.uv.numItems = numVertices * 2;
//cubePoolGeometry.attributes.normal.numItems = numVertices * 3;

The full buffer is untouched and you can still get the total size by querying the array length (or save it for future reference). That was it.