We have a cloud product that uses three.js with OpenCTM meshes (http://openctm.sourceforge.net/, specifically using js-openctm https://code.google.com/p/js-openctm/). We recently discovered some strange behavior on some of our meshes when run on Mac OS Safari. The position vertices of some meshes would occasionally explode out to enormous values and we would end up with something like the result below:
It’s supposed to look like this (note that both of these screenshots are from the same sample webpage using the same meshes, the only difference is the browser and platform):
To reproduce, I am just hosting the attached webpage sample (based on the threejs CTM loader example available here: http://threejs.org/examples/webgl_loader_ctm.html) and opening it in Mac Safari. If it doesn’t show right away, try closing Safari, opening it again, and going directly to the sample again. I’ve seen it take a few tries. If that still doesn’t show the issue, try clearing your cache and trying again. However, for the attached demo page it seems to happen pretty consistently every time. Strangely, I can make the issue stop by reloading with the Safari Developer Tools open (which of course makes it difficult to actually debug). When this was showing in our cloud product, I was actually able to prevent the issue from showing by adding a whole bunch of console log statements inside the ctm.js file that loads CTM files (specifically within the CTM.restoreVertices function) which makes me think there’s some sort of timing issue happening.
I spent a lot of time trying to debug the issue, but so far I’ve been unable to determine the root cause. I can say that I inspected each CTM file in the OpenCTM viewer (available here: http://openctm.sourceforge.net/?page=download) and they all loaded and looked fine. It might be useful to know that we are using the MG2 method of compression for the CTM files. Also, I inspected the threejs scene object when the issue was showing and confirmed that the mesh position vertices were sometimes huge numbers, far larger than they should have been.
So far, I suspect a Safari bug, mostly because the issue is only reproducible in Safari and because it does not show when the Safari developer tools are open. I made a bug report with Apple, but I thought I should share here too.
When reproducing the issue I am running Safari Version 8.0.2 (10600.2.5) on a Mac Mini running OS X Yosemite Version 10.10.1. A coworker also reproduced the issue on his Mac, but I don’t have his specs. I am using ThreeJS r70.
Thank you for your time,
Max Strater on behalf of the Autodesk Configurator360 team