March 19, 2014

Preview 3D Models in Perforce Swarm

Helix Swarm


3D Model courtesy of the Blender Foundation |

Did you know that Swarm can render more than just your code? PDF documents, and web-safe images may have been obvious, but with the right setup Swarm will convert and display some strange image formats: EPS, PSD, TGA, TIFF. And some other useful formats: DOC, RTF, PPT, XLS, VSD (see the docs). Are there any other project assets that you would like to see? If your project involves game, hardware, or animation development, our 2014.1 release of Swarm will also preview some 3D model files (without any additional setup).

A recent development challenge ended up with the Swarm team piled into a boardroom for a three day hackathon. One of the resulting features was our new 3D model viewer. This is a feature that GitHub also provides for STL files, but we think that our own customers are even more likely to have these sorts of files. The hackathon prototype focused on one particular open model format that most 3D model editors support exporting to, called Collada. We continued work on the viewer, and now you can check it out in our latest release of Swarm.

In the 2014.1 release we have added the following 3D model formats for preview:

  • DAE - (collada) including any referenced web-safe texture images
  • STL - both binary and ASCII versions of the format
  • OBJ - including any referenced MTL files, and web-safe texture images

Simply rendering these files to web-safe images would not have accurately provided a full preview. So instead, we use new web technologies to provide a 3D model viewer for modern browsers. Our 3D viewer runs on the open source ThreeJS library, JavaScript Typed Arrays, HTML <canvas>, and WebGL. With them, we built a viewer that lets you rotate, pan, and zoom the 3D stage in order to get a good look at your model from every angle.

GitHub's model viewer also uses ThreeJS, and does a great job of rendering STL files. Both our usage and GitHub's allow you to view wire-frame STL files. GitHub has a useful feature where they highlight differences in the STLs between versions. Oddly enough, there doesn't appear to be that many publicly available STL files on GitHub. On the other hand, there are a lot of DAE files, partially due to the OpenCollada tests being hosted there. With Swarm, on our first release of the viewer, we focused on adding a few more formats, and supporting rendering of textured materials.

In the future we hope to add even more formats and features, so let us know what you use.