Commit Graph
151 Commits
Author SHA1 Message Date
Mr.doob a6c9984a67 Commented some WIP code in CanvasRenderer so it doesn't throw warnings while compiling.
Modified build script to avoid the extra full compilation.
2010-11-30 17:18:05 +00:00
Mr.doob 0f2badfdd1 Previous commit: Matrix4.transformMatrix4.transformVector3 and Matrix4.tranformVector4
This commit fixes what that change broke.
Removed chromatic distortion from WebGL reflection/refraction.
2010-11-30 16:15:16 +00:00
George Profenza 38d3d0a364 merged with r29 2010-11-30 14:26:11 +00:00
George Profenza caf2c2000f merging with r29 2010-11-30 13:45:00 +00:00
George Profenza 774b5e843d merged with original 2010-11-30 11:54:43 +00:00
Mr.doob 67250c69d9 Merging with alteredq's branch. 2010-11-30 05:06:46 +00:00
George Profenza 0528c143fc blender 2.49 exporter 2010-11-29 15:05:55 +00:00
George Profenza 61d7fe9575 c4d export 2010-11-29 14:40:00 +00:00
Mr.doob bddcebce95 Few changes to README 2010-11-28 07:06:16 +00:00
Mr.doob 34f802e392 Code clean up.
Removed old Blender exporters.
Slim exporter is now Normal exporter (needs some testing).
2010-11-28 06:52:59 +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 4adb1eea37 Added option to OBJ converter allowing to invert material transparency (some models interpret 0 as opaque and 1 as transparent). 2010-11-23 22:37:03 +01:00
alteredq f02f057677 Fixed broken material names generation in OBJ converter. 2010-11-22 22:12:54 +01:00
alteredq 0cdd188e17 Added MeshCubeMaterial: WebGLRenderer specific material for more efficient rendering of panoramas when doing cube mapping.
Also moved loadImageArray utility function from examples into TextureCube.js

To be used like this:

    var urls = [ "px.jpg", "nx.jpg", "py.jpg", "ny.jpg", "pz.jpg", "nz.jpg" ];
    var images = THREE.loadImageArray( urls );
    var textureCube = new THREE.TextureCube( images );

    // create scene

    var objectMaterial = new THREE.MeshBasicMaterial( { color: 0xffffff, env_map: textureCube } )
    createScene( objectMaterial );

    // create panorama

    var size = 100000;
    var panoMaterial = new THREE.MeshCubeMaterial( { env_map: textureCube } );
    var mesh = new THREE.Mesh( new Cube( size, size, size, 1, 1, null, true ), panoMaterial );
    sceneCube.addObject( mesh );

Warning: this functionality is currently changing a lot, expect things to get broken before stabilization.
2010-11-22 02:10:07 +01:00
alteredq 3ee99dc4c5 Added cube mapping to WebGLRenderer. Also added cube map example. Finally ;)
TODO:

  - maybe image array loader should go into TextureCube.js so that people could just reuse the code

  - it may be worth to be able to specify different combination of environment map and underlying material (in single render pass),
    currently color/color map/environment map are multiplied, though addition also produces very interesting looking materials
2010-11-18 02:00:11 +01:00
Mr.doob c16394d2ec Updated README.
Pushed REVISION to 29.
2010-11-17 05:45:35 +00:00
Mr.doob fbfa375d2c src/io/Loader.js ⟶ src/extras/io/Loader.js
Removed Loader.js from compiled lib
Fixed examples
2010-11-16 14:04:54 +00:00
Mr.doob 5e4476bde8 Now using Closure Compiler (~2kbytes) 2010-11-16 12:53:00 +00:00
Mr.doob 4d209ac433 Implemented material blendings (THREE.NormalBlending, THREE.AdditiveBlending, THREE.SubtractiveBlending) in CanvasRenderer
Added MeshNormalMaterial (per face)
2010-11-15 16:52:22 +00:00
Mr.doob 5feee3839f Trying to merge... 2010-11-15 01:56:10 +00:00
Mr.doob 98dc841aab Added MeshDepthMaterial.
Optimised Particles projection in CanvasRenderer.
2010-11-15 01:17:41 +00:00
Mr.doob 22f48a731b CanvasRenderer handles textures again.
Most of the examples working.
2010-11-13 07:11:57 +00:00
Mr.doob ce3d641ff2 Changed materials format a bit.
Almost done porting CanvasRenderer to the new material system (plus some performance gains on the way :D)
`Color` now handles hex with no alpha byte (probably there is a nicer way of doing it...)
2010-11-13 02:39:27 +00:00
unknown ed6f2ccd79 Testing workflow with branches - this should merge changes from "master" branch to "materials". 2010-11-12 17:06:59 +01:00
alteredq f9ec9325f9 Tested exporters with new Blender 2.55 Beta. It seems both old and new one work without any changes \o/ 2010-11-11 01:54:02 +01:00
alteredq b31c9bd8a3 Added handling of empty material slots in new Blender exporter.
Such broken materials will be replaced by dummy materials names like this "undefined_dummy_5".
2010-11-10 23:59:08 +01:00
alteredq ca7e2fc923 Added model alignment to new Blender exporter.
Fixed crash bug with non-textured models in new Blender exporter.

Fixed bottom alignment bug in OBJ converters.
2010-11-10 02:16:29 +01:00
alteredq baced836f3 Merge remote branch 'remotes/upstream/master' 2010-11-09 22:47:16 +01:00
alteredq c545318b51 Added experimental Blender exporter for the new ascii JSON format.
Models exported by this version should be loaded like this (the same as for slim OBJ converter):

    var loader = new THREE.Loader();
    loader.loadAscii( "path/to/model/Model.js", function( geometry ) { createScene( geometry ) }, "path/to/model" );

Compared to OBJ converter, currently only single mesh is exported (many models are composed of several meshes).

TODO
    - model alignment
    - copy used images to folder where exported file goes
    - export all selected meshes / all meshes in the scene?
    - binary format
2010-11-09 22:44:22 +01:00
alteredq b3bacc8af8 Refactored OBJ slim converter (to make it easier to reuse ASCII converter snippets in Blender exporter). 2010-11-09 22:22:39 +01:00
Mr.doob a7d70a0eff * Builders clean up 2010-11-09 06:27:44 +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 ecf97e0d4c Synced with sole's branch. 2010-11-08 20:10:32 +01:00
alteredq 97425e01ae Merge remote branch 'remotes/sole/master' 2010-11-08 20:04:26 +01:00
alteredq 1ca0bf23dc Merge remote branch 'remotes/upstream/master' 2010-11-08 18:17:02 +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
sole b489e524ea Build system: now --debug applies to the current build (can generate debug versions of every type of build: canvas, dom, etc) 2010-11-08 11:43:13 +00:00
sole cb626b9d95 Merged with alteredq version (support python 2.6) and also made it more explicit as per mrdoobs suggestion 2010-11-07 19:46:53 +00:00
alteredq b14f09be61 Merged with sole's branch: took new Python build script, made it work with my ancient Python 2.6. 2010-11-06 19:50:37 +01:00
alteredq 7abad40d83 Merge remote branch 'remotes/sole/master' 2010-11-06 19:23:28 +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
sole e43af53f19 refactored build system 2010-11-05 14:21:54 +00: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
Mr.doob 9a62d1173a Refactored ClickResolver to Ray and Projector.unprojectVector` working.
Unimpressive example added `interactive_spheres.html`
2010-11-04 03:35:08 +00: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 88c5d3e571 Forgot to build one-file version and to bump up version number. 2010-11-02 19:28:53 +01:00
alteredq 7c163bb9c1 In OBJ converter made smooth/flat shading configurable via command line parameter (-s smooth|flat). 2010-11-02 18:59:23 +01:00
alteredq 93c2ed9474 In OBJ converter added handling of cases where there are no materials specified in OBJ file (which is different from having null materials or no MTL file). 2010-11-02 12:02:37 +01:00
alteredq 1c35d90fd7 Added handling of multiple lights to WebGLRenderer.
Limitations:

 - Chrome can handle up to 5 lights in total (directional + point)
 - Firefox seems to handle up to 29 lights

These number are GPU specific (mine is ATI Mobility Radeon 3650).

This turned out to be quite tricky. The number of varying vectors in shaders is limited. Additionally Chrome and Firefox have different limitations (at least on Windows, probably due to Chrome using ANGLE as rendering backend).

Hence WebGLRenderer has hardcoded limit of maximum 5 lights.

WebGLRenderer constructor now takes (optional) scene argument, so that numbers and types of lights present in the scene can be used to generate minimal possible shader.

If no scene is passed, shader allowing 1 directional + 4 point lights will be generated.
2010-10-31 00:45:04 +02:00