Commit Graph
44 Commits
Author SHA1 Message Date
Bartek Drozdz 9850695f38 Collisions system initial commit. 2011-04-04 18:13:54 +02:00
alteredq 827dcdd908 Added handling of UVs to Blender importer. 2011-03-28 04:17:38 +02:00
alteredq b31b8eebcd Changed exporters, converters and example models to use more proper JSON.
Single quote property names and hex numbers are not valid in JSON.
2011-03-26 06:05:46 +01:00
alteredq 1859fe4057 Updated Blender exporter to be able to export scenes.
Work-in-progress.

So close yet so far. Test scene almost works, just two things are not rotated properly (which means maybe everything will need to be reworked :(
2011-03-25 04:39:04 +01:00
Mr.doob 60ac9f8c2c Suzanne is the new Cube. 2011-03-23 06:36:10 +00:00
alteredq d9a930caa4 Added second cube for Blender vertex color example (courtesy of mrdoob). 2011-03-22 04:29:08 +01:00
alteredq 9db71a171a Fixed tangents and UVs in Blender exporter.
Also updated docstring for OBJ converter.

All WebGL examples should now work.
2011-03-22 00:32:45 +01:00
alteredq 044a27b530 Merge remote branch 'remotes/upstream/experimental' into experimental 2011-03-21 05:38:53 +01:00
alteredq 071de366c2 Updated Blender exporter to export new JSON format.
Also some fixes along the way to properly handle vertex colors in loaders.

Many things still broken, but we move forward.
2011-03-21 05:36:12 +01:00
Mr.doob f35e8092c6 More uvs fixes.
About to try to bring Face4 back.
2011-03-21 02:59:02 +00:00
alteredq 2989defcc8 First version that is at least partially working with the new model format ;).
Tons of things still broken.
2011-03-21 00:58:12 +01:00
alteredq a230b659ab More fixes.
Getting closer though still having some junk data poping out here and there.
2011-03-20 22:25:41 +01:00
alteredq bdc19a15c2 Updated OBJ converter to create new JSON model format.
Not tested yet, as the rest of the engine doesn't work yet.
2011-03-20 20:14:23 +01:00
alteredq ff832976b2 Removed underscores from texture filenames to please GitHub. 2011-03-15 17:59:32 +01:00
Mr.doob 88c2d7c77b Moved Object::sortObjectByMaterials to WebGLRenderer (so it's done automagically).
WebGLRenderer: renamed geometryChunks to geometryGroups :P
2011-03-02 15:51:09 +00:00
alteredq ccdff87382 Changed also JSON model files and exporters/converters to use CamelCase property names.
Only Blender 2.56 exporter and OBJ converter were tested. If somebody is using other ones, please reexport some files to be sure they work.
2011-03-02 05:55:29 +01:00
alteredq a9af9481e5 Added vertex colors to ASCII model loader and to Blender exporter (plus corresponding example).
Also fixed quads vertex color bug in WebGLRenderer and did small optimization of face state handling.
2011-02-14 20:21:42 +01:00
alteredq 6e91de5d8a Added diffuse map to normal map shader. Changed Lee Perry-Smith demo to use normal map shader.
Diffuse map and ambient occlusion maps are now optional in normal map shader.

By default, both are disabled, so they need to be enabled explicitly like this:

    uniforms[ "enableAO" ].value = true;
    uniforms[ "enableDiffuse" ].value = true;
2010-12-26 03:03:28 +01:00
Mr.doob 93fa1df174 Added Lee Perry-Smith Normal-notyet-Map demo. 2010-12-25 20:32:13 +00:00
Mr.doob cee1d4832f Merge remote branch 'alteredq/master' 2010-12-09 13:33:36 +00:00
alteredq ac5276b41f Added normal + ambient occlusion + displacement mapping demo.
A lot of things going on in this commit:

- added tangents computation for geometries
    - mesh must have UV coordinates
    - to be called explicitly once geometry is loaded like this: geometry.computeTangents()
    - tangents are stored in Vertex objects
    - quads are not solved properly (though workaround hack seems to work at least somehow, as far as each vertex appears at least somewhere)

- extended VBOs in WebGLRenderer to include tangent streams (when available)

- added "normal" shader to ShaderUtils (to be used with MeshShaderMaterial)
   - Blinn-Phong with one directional and one point light (7 varyings gone, just one spare)
   - normal maps are in tangent space
   - displacement maps use simple luminance value (could be changed if better precision is needed)

- displacement mapping uses vertex texture fetch
    - this requires GPU with Shader Model 3.0
    - not currently supported in ANGLE
    - for this, added "supportsVertexTextures" method to WebGLRenderer API, so that application can handle this
2010-12-09 12:27:49 +01:00
Mr.doob 10e21dde88 Geometry::computeNormalsGeometry::computeFaceNormals 2010-12-08 15:59:10 +00:00
Mr.doob f0cb056812 Cleaning up unused files. 2010-12-06 06:40:55 +00:00
Mr.doob 584a8440fd Merging with alteredq's branch. 2010-12-02 17:24:56 +00:00
Mr.doob e72b82cda2 Merging with orgicus' branch. 2010-11-30 17:30:45 +00:00
Mr.doob a2acf0b390 CanvasRenderer/SVGRenderer: RenderableFace4 is now gone. Unfortunately it created more problems than it solved.
CanvasRenderer now with ShadingSmooth, or something along the lines...
2010-11-27 11:30:01 +00:00
alteredq a20d9102ce Few small tweaks to cars demo.
Changed materials a bit to look better with lighter environment map.

Added space to buttons HTML so that Firefox don't draw them sticked together.

Also re-added htaccess for BIN files.
2010-11-25 02:10:54 +01:00
Mr.doob 8e8dfe2d01 Tweaked cars demo a bit. 2010-11-24 23:55:34 +00:00
alteredq 696c70152d Added cars demo.
Not sure about adding car models, they are quite big (even binary ones). To be removed if it makes troubles with git / GitHub.
2010-11-24 23:06:23 +01:00
alteredq bc11316ae9 Back at master branch.
Hooray. So long materials branch, you served us well ;)
2010-11-17 20:31:39 +01:00
Mr.doob 5feee3839f Trying to merge... 2010-11-15 01:56:10 +00:00
alteredq a0fa2ae3dd Optimized binary model format to use indexed UVs. Updated OBJ slim converter and Loader accordingly.
This saves about 10% from size of textured binary models.
2010-11-08 23:20:25 +01:00
alteredq 188f36be5d Optimized ASCII model format to use indexed UVs. Updated OBJ slim converter and Loader accordingly.
This saves ~22% from size of textured ASCII models.

TODO: make the same for binary model format.
2010-11-08 18:10:43 +01:00
alteredq 514a2e6135 Merged with latest changes in mrdoob's branch. All hex colors should be now without baked opacity. 2010-11-06 18:59:03 +01:00
alteredq 0cb79310e5 Added experimental binary mesh loader. Updated OBJ converter and examples accordingly.
If you want to use binary format, convert OBJ models using "convert_obj_threejs_slim.py" with "-t binary" option.

This will now create two files:
    JS part with materials
    BIN part with binary buffers

Binary models are loaded like this:

loader.loadBinary( 'obj/lucy/Lucy250k_bin.js', function( geometry ) { createScene( geometry, s ) }, "obj/lucy" );

(difference to ascii format is that url root must be always specified so loader can find binary buffers file, like it already was for textures)

Good news:

- raw binary files are quite smaller than raw ascii files (about half size)
- loading times went down about 20-25%
- now also Firefox can handle 250k triangle mesh (it just bugs about long running script), with ascii format it threw "array initialiser too large" exception

Mixed news:

- gzipped binary files are only about 25% smaller than gzipped ascii files so actual benefits are smaller,
  also it's more likely server will have JS gzipping on by default, while you need to set it up for
  other formats (could be hacked around by naming binary files with JS extension instead of BIN?)

Bad news:

- browser blocking is back :( Not that it ever went completely away (for large models object creation is more costly than loading and it is blocking), but it was slightly better with ascii loader (where data is loaded as worker's JS body).

    - this comes from having to use Ajax to load binary data
    - loading binary data by Ajax from within worker didn't really help, it was in fact slightly slower and browser did freeze :(
    - can't easily embed binary data in JSON (would need to encode it which would make it bigger, defying the purpose)

- Loader got fatter

Also in this commit: renamed Loader.loadAsync() => Loader.loadAsciiOld() and Loader.loadWorker() = Loader.loadAscii() so that names correspond to model formats instead of underlying implementation.

loadAsciiOld - JS exported by Blender and old OBJ converter
loadAscii    - JSON created by slim OBJ converter (-t ascii)
loadBinary   - JSON + BIN created by slim OBJ converter (-t binary)

TODO:

 - look into UV coordinates, should be indexed the same way as vertices, normals and faces are (instead of unrolled per each face)
 - look into HTML5 File API, binary blobs could help
2010-11-06 17:24:58 +01:00
alteredq 49d1bd170b Made JSON model format slimmer by flattening arrays. Modified Loader and OBJ converter accordingly.
This is a first step towards eventual binary model format.
2010-11-04 21:18:08 +01:00
alteredq 5192428f25 Added Loader class providing both asynchronous JS and web worker based loading of models.
The idea is that later there will be more loaders which would load different formats (like OBJLoader, ColladaLoader).

Usage (async JS):

var loader = new THREE.Loader();
loader.loadAsync( "obj/torus/Torus.js", function() { createScene( new Torus() ) } );

Usage (web worker):

var loader = new THREE.Loader();
loader.loadWorker( "obj/torus/Torus_slim.js", function( geometry ) { createScene( geometry ) } );

Web worker loader is useful for large meshes, where it allows browser to stay responsive for longer time and also it can handle larger meshes than async JS loader.

Web worker loader needs a simpler format of the model. Web workers can communicate with the main application only via message passing, where messages are JSON objects.

There is a new version of OBJ -> Three.js converter (convert_obj_threejs_slim.py) which can produce model in format needed for web workers.

All examples which were using models from OBJ converter were refactored to use Loader.

Except large mesh example, all examples are using just async JS loading. Web worker loading is there, it's just commented out, as it's a bit pain for local development.

Chrome doesn't allow to run web workers from pages accessed via file://, so you need either to run it with "--allow-file-access-from-files" flag, or access examples via local server (http://localhost/example.html).
2010-11-03 18:12:31 +01:00
alteredq 2b1f0a9b97 Added Lucy model (100k triangles version). The example using it already went to previous commit. 2010-11-02 19:15:26 +01:00
alteredq f32fc45541 Added WebGL version of pointlights example (including Walt's head mesh with vertex normals). 2010-10-31 01:46:20 +02:00
alteredq 79ab4bf2e6 Merged with mrdoob's branch. Got WebGLRenderer working again :)
Changed OBJ -> Three.js converter to use new materials system (eventual old models need to be reconverted).

Limitations:

  - one use case is now much slower
    - when a mesh has each face with different color (e.g. polyfield in examples/test.html)
    - before this used FaceColorFill material and in WebGLRenderer it was rendered fast with color attribute array
    - now when FaceColorFill material is gone, each face gets own VBO :(

  - material sorting uses Materials "toString" methods for hashing, so it's very important to keep these in a good shape
2010-10-28 19:35:13 +02:00
alteredq ca261ddca5 Added point light / fixed directional light in WebGLRenderer / added light test example.
Changed WebGLRenderer to use 3x3 normal matrix.

Limitations of WebGL lights:

- currently handles only single one of each ambient/directional/point light
- light intensity modifier not yet taken into account
- only diffuse term (this applies also in CanvasRenderer)
2010-10-24 18:52:42 +02:00
alteredq dde831bf6f Extended CanvasRenderer to be able to handle decals (MeshBitmapUVMappingMaterials as secondary materials).
For decals you need to set "decalIndex" property of the material (corresponding to materials index of the original mesh UV material).

Added multimaterials example.

Fixed forgotten sphere smoothing in OBJ converter example.
2010-10-21 01:38:29 +02:00
alteredq 396d8d1cec Added male model to OBJ converter example. 2010-10-18 14:19:39 +02:00
unknown 60c2354424 Added OBJ -> Three.js converter.
Added OBJ converter test example.

Modified Three.js to handle converted models:

 - extended WebGL renderer to use texturing
   - broke down model into multiple VBOs according to materials
   - textures are lazy created when images get loaded
     (converter takes care of resizing images to nearest power of 2
      dimensions using 2d canvas)

 - changed material array semantics in Mesh object
    - before: multiple materials were applied to all faces (broken in WebGL, needs multitexturing shader)
    - now: there is only single material per face, but one mesh can have faces with different materials

 - added per vertex normals (to get smooth shading in WebGL)
2010-10-18 11:33:32 +02:00