Commit Graph
361 Commits
Author SHA1 Message Date
Mr.doob 7277cc4ade Added a link to the blog post that explains the 4 point gradient texture. 2010-11-19 00:24:31 +00:00
alteredq 0610f5734f Fixed vertex shader to work in Mac. 2010-11-18 04:55:05 +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
alteredq 59280c0cbb Fixed performance issue in WebGL version of materials test. We are back at 60 fps ;) 2010-11-17 23:42:24 +01:00
alteredq 5535f71130 Added checks for nonexisting face materials if MeshFaceMaterial is used.
Cloned materials.html -> materials_gl.html to have easier test for WebGLRenderer.

TODO:

Investigate why this test is so slow. It shouldn't be, materials_shaders.html is more complex and yet it is much faster (36 vs 60 fps).

MeshFaceMaterial with every face different is pretty bad use case for WebGLRenderer, but this still doesn't fully explain slowdown :(.
2010-11-17 21:19:27 +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 c174157925 Compiled lib with julianwa's Line clipping fix. 2010-11-17 07:43:19 +00:00
Julian Walker 90d5ddf681 Fixed flickering issue when clipping lines with multiple segments. 2010-11-16 23:08:45 -08:00
Mr.doob aafc506270 Projector: Added header credit and reformated. 2010-11-17 06:20:48 +00:00
Mr.doob 2e38de39df Modified lines_test example to test Line clipping. Seems like there are some issues... 2010-11-17 06:11:36 +00:00
Mr.doob 9637daef88 Seems like the new Particle projection code got lost in the merge. Fixed. 2010-11-17 06:02:11 +00:00
Mr.doob c16394d2ec Updated README.
Pushed REVISION to 29.
r29
2010-11-17 05:45:35 +00:00
Mr.doob b025a6176d Projector merged succesfully. 2010-11-17 05:18:57 +00:00
Mr.doob 0d9dc84980 Merge remote branch 'julianwa/master' into materials 2010-11-17 05:07:25 +00:00
Mr.doob b8ae37245f Merging julianwa's branch 2010-11-17 05:07:16 +00:00
Mr.doob 2b92a824c2 Added FaceMaterial example in materials demo. 2010-11-17 04:56:47 +00:00
Mr.doob 9c12250c61 Merge remote branch 'alteredq/materials' into materials 2010-11-17 04:53:43 +00:00
Mr.doob ec0de29153 Merging alteredq branch 2010-11-17 04:53:21 +00:00
Mr.doob 7dd33d6df6 Merging with alteredq branch 2010-11-17 04:51:43 +00:00
Mr.doob 51f91fdd03 Removed alpha component from the Color class
GouraudShading and PhongShading ⟶ SmoothShading
2010-11-17 04:49:30 +00:00
alteredq e98d8da4ad Added poor man's additive blending to WebGLRenderer.
Render first objects / material groups that use normal blending, then render ones which use additive blending.

Proper solution should be: sort triangles by blending, render all the normal ones, sort additive ones by depth and then render them back to front.

http://www.opengl.org/resources/faq/technical/transparency.htm
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=08

While this is acceptable in C++ / OpenGL, with JavaScript / WebGL this would kill the performance (you would need to sort triangles in JS and also create new buffers every frame).

Also tried to come up with subtractive / darken blending, but didn't find any satisfactory formula :(.
2010-11-17 05:42:56 +01:00
Julian Walker 49f878c5a5 * Added near and far plane clipping for THREE.Line rendering in CanvasRenderer.
* Changed THREE.Vertex.positionScreen from a Vector3 to a Vector4 to support clipping.
2010-11-16 20:40:02 -08:00
alteredq 3d3708919b Added support to "shading" materials parameter in WebGLRenderer.
This is actually tricky due to multimaterials and vertex normals.

The practical effects of "shading" parameter in WebGLRenderer are currently following:

- if your model has vertex normals, now you can "dumb down" its shading by specifying THREE.FlatShading for MeshLambertMaterial and MeshPhongMaterial
- if your model has only face normals, it will always have just flat shading, no matter which shading you set, no escape from this
- if your model has multiple materials, smooth shading always "wins", meaning if there is at least one smooth shaded material in multimaterial group, all other materials in this group will be also smooth shaded (this is solvable by having multiple normal buffers, but seems wasteful, at least for the moment, till there are no practical use cases)

Currently implemented shading / material combinations:

  - MeshNormalMaterial: FlatShading [default], GouradShading
  - MeshDepthMaterial:  no shading parameter in material, uses own specific shading
  - MeshBasicMaterial: no shading parameter in material, uses own specific shading
  - MeshLambertMaterial: FlatShading, GouraudShading [default]
  - MeshPhongMaterial: FlatShading, PhongShading [default]
2010-11-16 22:38:06 +01:00
Mr.doob f7d71abc3e Improved materials demo. 2010-11-16 17:22:37 +00:00
Mr.doob 23688daf08 Added WIP materials example (showing all at once). 2010-11-16 14:57:06 +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 b449fdf5a8 Added a variation of the interactive example (using Tween.js) 2010-11-16 13:35:47 +00:00
Mr.doob 5e4476bde8 Now using Closure Compiler (~2kbytes) 2010-11-16 12:53:00 +00:00
Mr.doob dc6e335dc9 Color: Nicer way to check whether the hex has the alpha component or not. Removed unused methods.
CanvasRenderer/SVGRenderer: More code clean up and optimisations.
2010-11-16 12:27:25 +00:00
Mr.doob fe82bdbda9 Came up with a crazy approach to get Vertex Colors. Gouraud yet on step closer.
Changed the DepthMaterial to use this approach instead.
2010-11-16 11:02:45 +00:00
Julian Walker 592ea71e48 Merge remote branch 'upstream/master' 2010-11-15 22:18:58 -08:00
Julian Walker 1f0b44a860 Added multiplyScalar and divideScalar to Vector4. 2010-11-15 22:18:40 -08:00
Mr.doob c6d69d8286 Refactored the CanvasRenderer a bit. 2010-11-16 05:54:37 +00:00
alteredq 9081529d84 Made all examples working again. 2010-11-16 03:06:46 +01:00
alteredq 007ee285fa Added MeshNormalMaterial support to WebGLRenderer. 2010-11-16 02:50:46 +01:00
Mr.doob 7b58b806d3 Fixed NormalToComponent function (it was over saturated). 2010-11-15 17:04:10 +00:00
Mr.doob bf3dede88a Implemented MeshNormalMaterial in SVGRenderer
SubstractiveBlending ⟶ SubtractiveBlending
2010-11-15 16:56:14 +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 696bd4715f Added another depth material test. 2010-11-15 09:12:37 +00:00
Mr.doob 7d8fd5f874 CanvasRenderer now renders MeshDepthMaterial properly (per vertex). Gouraud is one step closer :)
Cleaned up CanvasRenderer and SVGRenderer code a bit.
2010-11-15 08:50:31 +00:00
Mr.doob 05b496d822 Merge remote branch 'alteredq/materials' into materials 2010-11-15 04:16:51 +00:00
Mr.doob d2b6d7df0c Updating README's example 2010-11-15 04:16:43 +00:00
alteredq 0163e4f2f5 Added (commented out) MeshDepthMaterial support to WebGLRenderer.
It's commented out, as it breaks shader validation in current Chrome :(.

There seems to be some bug in Chrome / ANGLE making it barf when using "gl_FragCoord" in fragment shader.

Curiously, while it breaks both 9.0.576.0 dev channel and latest continuous build 9.0.583.0, it does work fine in canary build with the same version as dev channel (9.0.576.0).

Go figure. Also in Firefox 4 beta 7 it works fine.

It seems there were some recent changes in handling of "gl_FragCoord" on Windows which probably broke something when fixing other bug:

http://code.google.com/p/chromium/issues/detail?id=59762
http://code.google.com/p/angleproject/issues/detail?id=71

TODO: make isolated test case and submit bug report (if this doesn't go away in next Chrome update).
2010-11-15 04:49:28 +01:00
Mr.doob 7264105fe9 Merge remote branch 'alteredq/materials' into materials 2010-11-15 02:06:27 +00:00
Mr.doob 591c4c5bef Merging alteredq branch. 2010-11-15 02:06:18 +00:00
Mr.doob 6f58fb8e11 Compiled again just in case. 2010-11-15 02:02:45 +00:00
Mr.doob 5daf1e0192 Merge remote branch 'alteredq/materials' into materials 2010-11-15 02:01:20 +00:00
Mr.doob 10449405dd I know I can do it... 2010-11-15 02:00:29 +00:00
alteredq b6e42d54d9 Added missing MeshDepthMaterial.js 2010-11-15 02:59:04 +01:00
Mr.doob fa48600918 Trying to merge... 2010-11-15 01:58:08 +00:00