Writing an iOS Webkit compatible 3D viewer? (Processing.js related)
in
Processing with Other Languages
•
1 year ago
So, let me start by explaining the high-level problem first...
I work for a company that wants a 3D model viewer that they can demo from safari on an ipad, embeded in their website. The second requirement is that this same 3D model viewer be embedded in their native iPad app.
...
Pretty hard problem, but the sticking point is how much they're pushing to be able to view the web portion of their tech in the iPad's browser.
Anyways, at first inspection it looked like Processing.js would be perfect, (it's even embeddable) except there's no word yet from apple on how long till iOS's support for WebGL, so it's stuck in 2D.
I've gotten a prototype working for building a mesh from a string that could be sent over an ajax request: (For testing, the mesh is a quad) and I've tested loading this from within a UIWebView in a native app on the device and it works perfectly.
The only conclusion I could come to was to implement the 3D rendering portion of the functionality myself until WebGL is supported officially by apple. *crosses fingers*
Since I don't need to handle textures, and I could pre-triangulate the mesh, it could be a feasible amount of work to write the renderer. I believe I just have to perform frustum & backface culling, 3d transforms, depth buffer, and polygon clipping.
Would it totally just be more-sane to render the data with the 2D renderer from a top down view and preprocessed mesh to avoid writing the more complicated portions of a 3d renderer until WebGL is supported? I imagine this might be more sane from a performance standpoint also because you can make better assumptions about what portion of the model is visible on the screen.
I would love any advice / thoughts on this at all, from where to get started working it in to processing.js' code to links to completely different technologies that could potentially solve this problem. Maybe I'm stuck looking at it the wrong way and someone can enlighten me!
Thanks in advance,
Jack Kern
1