Commit Graph
438 Commits
Author SHA1 Message Date
Mr.doob 40934a3a83 Merge remote branch 'alteredq/master' 2011-01-25 20:06:47 +00:00
Mr.doob 37a053b308 Fixed PointLight prototype code (thx rectalogic) 2011-01-25 20:05:46 +00:00
alteredq 8faa18b620 Added simple scene format loader.
This is very much work in progress - expect things to change and to be broken.
2011-01-25 18:32:07 +01:00
alteredq 52f4a750a3 Added simple tone mapping to HDR example.
Based on formula from: http://transporter-game.googlecode.com/files/HDRRenderingInOpenGL.pdf
2011-01-23 23:21:36 +01:00
alteredq 8f133abd30 Added HDR texture example. 2011-01-23 18:39:14 +01:00
Mr.doob 5accd0cfd7 Brought back Object3D.rotationMatrix (Projector still uses it). 2011-01-18 07:29:39 +00:00
Mr.doob 28e18bcf2c Added texture/disturb.jpg 2011-01-17 00:00:38 +00:00
alteredq 271ba6c524 Added support for "doubleSided" mesh property to WebGLRenderer.
Testing on current examples didn't show any noticeable performance degradation when enabling / disabling culling for every object in every frame.

"FlipSided" property could be probably done in very similar way, just setting "gl.frontFace( gl.CCW )" or "gl.frontFace( gl.CW )"
2011-01-16 15:10:58 +01:00
alteredq 6668440006 Cleaned bit postprocessing example code. 2011-01-16 14:35:17 +01:00
alteredq d50863908c Small improvements in postprocessing example.
Alternating convolution pass textures aspect ratio and using linear magnification filtering leads to less artefacts.
2011-01-16 11:51:56 +01:00
alteredq a03f714244 Added postprocessing example.
For this had to extend WebGLRenderer a bit:

- MeshShaderMaterial now can take non-specific float array uniforms as "fv1"
  (there is already "fv" type for array of 3-item-vectors, which probably should be renamed to "fv3" to be consistent)

- render method has yet another parameter "clear" for clearing newly set framebuffer (defaults to true).
  This is a bit hackish but it seems necessary to control this somehow. I didn't manage to replicate
  desired behavior just with autoClear.

- another dirty thing is accessing GL context from the application side:
    renderer.context.disable( renderer.context.DEPTH_TEST );

    This should be refactored somehow, wrapped in some API call.
2011-01-15 02:20:47 +01:00
alteredq 6cc1016477 Testing rendering to full-screen texture.
Requires to turn off mipmapping to be able to use non-power of two texture.

Effect of texture size on performance is noticeable, also there is no antialiasing (default in Chrome is I think 4x multisampling).

So I guess full-screen postprocessing will be quite costly :(. That's the price of WebGL always running at full-blown high resolution.

This could be somehow mitigated by faking lower resolutions via smaller texture, though I guess it still wouldn't be the same as having lower resolution set by GPU driver (this is a major help with performance in games - I never run full 1680 x 1050).
2011-01-14 15:16:14 +01:00
alteredq 7c9fe8ff82 Another update of render-to-texture example and related bugfix.
Rendering proper 3d object into the texture uncovered another issue - framebuffer had to be cleared after switching.

Texture is still flipped :( (original scene has small red torus on the top)

This is proving to be rather tricky. Yet again I tried to handle image coordinate mess in a proper way (UNPACK_FLIP_Y_WEBGL as texture parameter and non-inverted UVs), fixing hacks across the codebase.

This did indeed help with render-to-texture flipping, but instead it created really ugly problems with both normal map and minecraft AO demos. So back to square one :(
2011-01-14 12:39:57 +01:00
alteredq 707dc9d0a0 Refactored render-to-texture example.
Still flipped, though at least now it's consistent.
2011-01-14 02:05:16 +01:00
alteredq 916401fd96 Updated render-to-texture example so that it's easier to check texture orientation. 2011-01-14 00:51:26 +01:00
alteredq 9bc383e1ed Fixed discrepancy between ANGLE and OpenGL when rendering to texture.
Had to set viewport to make it work in OpenGL.

Also made it easier to see texture orientation in the example.

Now it's visible that there is indeed flipping. At least now it's consistent ;).
2011-01-13 22:10:38 +01:00
alteredq cee7205670 Added simple render-to-texture example.
Something is broken as OpenGL shows different result than ANGLE :(

Though this time it's ANGLE which seems correct.
2011-01-13 17:04:36 +01:00
alteredq 0f5652390f Added dynamic geometry support also for WebGL lines. Changed line strip example to use Hilbert curves.
Also fixed tons of bugs in lines handling.

TODO: make some example for dynamic lines.
2011-01-13 14:12:18 +01:00
alteredq fe6008b616 Added basic support for dynamic geometry in WebGLRenderer (with silly ocean example).
If you want to refresh VBOs (and thus have geometry changes reflected in renderer), you need to set dirty flags on geometry object.

There are separate flags for different buffers (as not always all buffers need to be updated and oh my is updating costly):

    mesh.geometry.__dirtyVertices = true;
    mesh.geometry.__dirtyNormals = true;
    mesh.geometry.__dirtyUvs = true;
    mesh.geometry.__dirtyTangents = true;

    mesh.geometry.__dirtyElements = true;

That was quite tough feature, a lot of refactoring, yet performance is still quite bad :(

The biggest remaining bottleneck seems to be translation between Three.js internal data formats and buffers. I removed as much per-frame arrays creation as I could, but even just iterating through existing data and setting of values is still very costly. Also per-frame normals computation is expensive.
2011-01-12 00:57:04 +01:00
Szymon Nowak 868cab1e98 Very basic example for RTT feature. 2011-01-09 20:53:56 +01:00
alteredq 5273e091d1 Merge remote branch 'remotes/upstream/master' 2011-01-09 07:38:22 +01:00
alteredq bc9cf2be75 Fixed scene check bug in allocateLights in WebGLRenderer.
Also some refactoring of initWebGLObjects slipped in this commit.
2011-01-09 07:37:20 +01:00
Mr.doob d5a2122598 Merge remote branch 'alteredq/master' 2011-01-09 02:47:06 +00:00
alteredq 2c2b9b81bf Optimized line strip example. 2011-01-08 05:27:35 +01:00
alteredq bbe2a3bf56 Refactored handling of continuous lines: now they are rendered using LINE_STRIP primitive. Added example for this.
Also renamed associated constant to THREE.LineStrip (was THREE.LineContinuous).
2011-01-08 01:15:01 +01:00
alteredq f90bc532c4 Fixed stats widget appearance issues that appeared with recent Chrome updates.
Unfortunately performance issues are still there and now already trickled down also to dev channel :(

I wonder what they did - fps numbers look more or less ok, problem is more with subtle yet very annoying choppiness. Like if somewhere suddenly bandwidth / memory is getting trashed.
2011-01-06 23:25:43 +01:00
alteredq a783870b61 Refactored OBJ converter demo not to have separate materials per each sphere.
Also first time I noticed issues with stats widget in latest Chrome canary 10.0.624.0 / Chromium continuous build 10.0.629.0:

 - it doesn't show in demos with mixed canvas / WebGL content (OBJ converter demo, lights test)
 - simply just adding it can significantly decrease performance (OBJ converter demo is choppy when invisible stats element exists)
 - in some demos it has different transparency (Walt cubemap demo)

Looks like with some Chrome update in last few days we hit some new compositing or 2d canvas issue (both OpenGL and ANGLE versions share the same issues).
2011-01-06 02:23:27 +01:00
Alex Schworer 3b9d05563f close style tag 2011-01-05 16:50:05 -08:00
alteredq 99bbc4880b Fixed bug in shader demo.
Texture wrapping had to be "repeat".
2011-01-04 08:05:28 +01:00
alteredq fb63495caf How to use 2d shaders as procedural animated textures.
Still some bug with textured one :(
2011-01-04 07:42:17 +01:00
alteredq 8ea0f27602 Refactored lines grid in materials_gl example. 2011-01-04 05:14:10 +01:00
alteredq 548c331519 Added crude lines support to WebGLRenderer.
As expected, performance of one-to-one conversion from CanvasRenderer was horrible, so I had to change a bit how lines are handled.

Line object now has "type" property:

    - default type is "THREE.LineContinuous" which should behave as before: geometry represents one continuous line (v0 ... vn)

    - new option is "THREE.LinePieces" which tells renderer that geometry represents collection of individual line segments (v0,v1) ... (vn-1, vn)

(one Line object corresponds to one VBO)

(same limitations as with meshes - once VBO is baked, no changes are possible except object transforms - scale / rotation / position)
2011-01-04 04:38:25 +01:00
alteredq 771674d705 Refactored Loader parameters to allow optional separate paths for texture and binary files.
loader.loadAscii and loader.loadBinary now take just one parameter with following properties:

    - model (required)
    - callback (required)
    - texture_path (optional: if not specified, textures will be assumed to be in the same folder as JS model file)
    - bin_path (optional: if not specified, binary file will be assumed to be in the same folder as JS model file)

Example use:

    loader.loadBinary( { model: "model.js", bin_path: "path/bin", texture_path: "path/img",
                         callback: function( geometry ) { createScene( geometry ) } } );
2011-01-02 19:52:40 +01:00
Mr.doob c186b37be3 Pushed revision to 32.
Updated README.
2010-12-31 17:59:11 +00:00
Mr.doob a964d27b72 Wrong repository =_= 2010-12-31 04:44:06 +00:00
Mr.doob f8e223258b testing... (data seems to be broken?) 2010-12-31 04:43:18 +00:00
alteredq ecad27eb11 Moved MeshPhongMaterial onto common shader builder machinery, ubershader is no more.
Code is still rough around edges (it can be made nicer), though it should already produce one-to-one results with ubershader.

Side-effect is that scene is no longer required as WebGLRenderer constructor parameter. Shader programs are now constructed upon first frame render and only then scene lights are examined.
2010-12-31 00:33:39 +01:00
alteredq 8ed9a9c403 Fixed shader demo to work with Firefox. 2010-12-30 01:11:47 +01:00
Mr.doob 9b755e827f Added "v2" uniform type to WebGLRenderer.
Added a shader demo (as in using only 2 triangles).
2010-12-29 23:09:59 +00:00
Mr.doob 041054283a Messing with a new terrain generator demo. 2010-12-29 03:22:30 +00:00
alteredq 0fe464c97a Refactored uniforms cloning into separate file so that it can be reused also for MeshShaderMaterials.
Also changed MeshShaderMaterial demos to show how to use cloning. For these particular demos uniforms cloning is not really necessary as they use only one instance of shader material, but for example, if there were two normal mapped models in one scene, each model would need separate material with own uniforms.
2010-12-28 17:11:50 +01:00
alteredq ecdbb2ef91 Fixed broken uniforms cloning. Fixed broken uqbiquity test.
TODO: start using uniforms cloning also for MeshShaderMaterials.
2010-12-28 14:33:52 +01:00
Mr.doob 674613a7ab Yet some minor tweaks to the normalmap2 demo. 2010-12-27 01:26:08 +00:00
Mr.doob 3488a53798 Recompiled builds.
Re-tweaked normalmap2 demo.
2010-12-27 01:22:48 +00:00
Mr.doob ebaa3ae392 I knew it wasn't going to work. 2010-12-27 01:17:52 +00:00
Mr.doob 897a2938c5 Merged with alteredq's normal shader improvements.
Tweaked normalmap2 demo parameters.
2010-12-27 01:08:29 +00:00
Mr.doob 4a486f858a Added uNormalScale to normal shader.
Updated normalmap2 demo inverting the X/Y components.
2010-12-26 23:54:35 +00:00
alteredq fb7788f0c6 Resurrected exponential fog as FogExp2.
For the moment, only one type of fog is baked into shader, depending on scene.fog initial value.

If use case arise for dynamic fog type switching, this could be changed, though than both fogs would need to be computed all the time :S.
2010-12-26 04:11:35 +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 03c5f0f859 Improving fog effect :) 2010-12-25 23:27:39 +00:00