To be used like this:
python convert_obj_threejs_slim.py -i model.obj -m morph*.obj -o model.js
Morph filename strings can contain wildcards "*,?,[]".
For including morphs from multiple folders, use quotes and separate filename patterns by space:
python convert_obj_threejs_slim.py -i model.obj -m "folderA/morphA*.obj folderB/morphB*.obj ..." -o model.js
PathCamera automatically follows path passing through waypoints (interpolated via Catmull-Rom spline). View angles can be constrained and controlled by mouse.
Work in progress, there are still some issued to be solved (constant movement speed, broken automatic update, broken frustum culling).
Made face flipping heuristics optional, it messes up scenes that are ok.
For scenes that after exporting have objects with flipped normals, original assets can be fixed in Max in a following way:
1. find out problematic objects in Max
1. select all objects
2. set View -> xView to show "Face Orientation"
3. select all object that are fully/mostly green
4. in Utilities apply Reset XForm to selected objects (this will show messed normals also in Max, otherwise they are hidden)
2. fix problematic objects
1. apply Normals => flipNormals modifier to selected object
If no object is passed to initMaterials (for example, if material is pre-built while loading, or shader program is intended for sharing), max limit of 50 bones is used (should be enough to leave space for other uniforms not to hit ANGLE limits).
Hope so. At least now hacked face normals correspond to face normals computed from scratch in Geometry.
(If only max didn't have zillion ways how to achieve the same visual results :/. I tracked this flipped normals/faces business down to XForm modifier - it doesn't get collapsed properly when making TriMesh / Editable_mesh snapshots. At least Editable_mesh snapshot differs in way that is exploitable for workaround hack.)
Went through all examples, all should work.
JSON files exported from Blender / converted from OBJ files still use underscored property names internally. I don't know, should these also be changed?
Now you can add keyboard + mouse camera control with a single line, just change camera type and add parameters:
camera = new THREE.QuakeCamera( { fov: 50, aspect: window.innerWidth / window.innerHeight, near: 1, far: 10000,
movement_speed: 1, look_speed: 0.002, nofly: true, look_vertical: false } );
Thanks to mrdoob for suggestions ;)
build/Three.js - Includes all renderers + extras
build/custom/ThreeCanvas.js - Canvas renderer only
build/custom/ThreeDOM.js - DOM renderer only
build/custom/ThreeSVG.js - SVG renderer only
build/custom/ThreeWebGL.js - WebGL renderer only
build/custom/ThreeExtras.js - Extras only
Moved `THREE.Detector.js` to `examples/js/Detector.js`.
Updated examples to reflect these changes.
It provides a lean way how to render TRIANGLE_STRIP primitives: needs just n+2 vertices for n triangles (one Ribbon = one strip). There are no faces, no indices, everything is rendered in one simple drawArray call.
Vertex colors are supported, normals not yet.
We have been very lucky - setters / getters were not supported till just 2 hours ago (so fresh, I had to build Closure myself from their repo ;).
http://code.google.com/p/closure-compiler/issues/detail?id=249
Also some refactoring plus added hackish animation offset feature.
Created "THREE.Supports" object, which should centralize this stuff. So far it detects <canvas>, WebGL and WebWorkers; later it could detect for example GPU capabilities.
Not sure about name or location, but it's pretty tiring go through all examples when something changes, so it should be somewhere in the library.
Code duplication is bad: even html snippets with error message should be centralized somewhere, so that when new browsers arrive we wouldn't have to keep changing them in many places.