Commit Graph
704 Commits
Author SHA1 Message Date
astrodud 151ff4394e slight speedup in Matrix4.rotationAngleAxisMatrix by cutting down object lookups and redundant multiplications 2011-01-17 21:41:13 -08:00
astrodud f3fd1bcfe6 slight speedup in Matrix4.determinant by cutting down object lookups 2011-01-17 21:38:56 -08:00
alteredq d1514ca6a7 Refactored lights handling in WebGLRenderer.
This should be the last place where new arrays were created in "render".

Chrome memory now seems stable.

Firefox still grows like mad, though this used to be like this also with other demos (simply setting random values to existing arrays does this).

Seems like Mozilla folks themselves struggle with this:

http://www.flickr.com/photos/11280278@N04/5363335103/in/photostream/
2011-01-17 20:22:46 +01:00
alteredq e54d9519d0 Changed wireframe rendering in WebGLRenderer to show quads.
See discussion here:

https://github.com/mrdoob/three.js/issues#issue/92
2011-01-17 18:44:09 +01:00
alteredq 08f6ceef15 Small optimizations to matrix math.
For the moment just things that are executed every frame in WebGLRenderer.render.

Continuing with quest to minimize creation of new data structures. Should instead create per class/object structures and just reuse them (as gman does in ThreeD). Main goal is to avoid annoying garbage collection pauses.

Let's hope it didn't break something (could be if some code was dependent on cloning of return values of "flatten" or "makeInvert3x3", though from what I checked these are just used to set typed arrays uniforms).
2011-01-17 16:09:26 +01:00
alteredq e37223a849 Synced with mrdoob's branch. 2011-01-17 08:25:42 +01:00
Mr.doob 28e18bcf2c Added texture/disturb.jpg 2011-01-17 00:00:38 +00:00
astrodud a62dc97e60 added LathedObject to build script for extras options 2011-01-16 15:27:19 -08:00
astrodud ebd21f962b GeometryUtils.merge should obey object2.autoUpdateMatrix 2011-01-16 15:26:00 -08:00
alteredq d110c49c2f Added support for flipSided mesh property to WebGLRenderer.
Also doesn't seem to decrease performance so far (though most of demos have small number of objects).
2011-01-16 21:46:23 +01: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 61e0bf0289 Synced with mrdoob's branch. 2011-01-16 03:07:56 +01:00
timk 1fbe2bfdbf CanvasRenderer::setSize didn't clear _contextGlobalAlpha et al 2011-01-16 00:43:51 +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 b511fdc38b Merged szimek's render-to-texture branch.
This is untested, as example is in different branch, have to commit this merge first.

At least this didn't seem to break existing things.
2011-01-13 15:27:08 +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 15407b01e7 Merge remote branch 'remotes/upstream/master' 2011-01-12 01:00:26 +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 6294caed07 Added render-to-texture feature to WebGL renderer. 2011-01-11 10:10:05 +01:00
oosmoxiecode 6963a57963 Merge branch 'master' of https://github.com/mrdoob/three.js 2011-01-09 21:50:52 +01:00
oosmoxiecode bf0c1a7a55 Uvs are messed up in this one, so it´s probably a good idea to fix that first ;) 2011-01-09 21:43:52 +01:00
oosmoxiecode 6759a5da11 /src/extras/primitives -> Torus.js + Torusknot.js 2011-01-09 21:32:31 +01:00
oosmoxiecode 3f05143a2a test 2011-01-09 21:25:13 +01:00
Szymon Nowak 868cab1e98 Very basic example for RTT feature. 2011-01-09 20:53:56 +01:00
Szymon Nowak 1d706dd789 Basic support for RTT. 2011-01-09 20:50:35 +01:00
Mr.doob d313693509 Merge remote branch 'alteredq/master' 2011-01-09 11:52:33 +00:00
alteredq 5273e091d1 Merge remote branch 'remotes/upstream/master' 2011-01-09 07:38:22 +01:00
astrodud 6fc34c9693 OK, replaced transformVector3 function with Matrix4.muliplyVector 2011-01-08 22:37:21 -08: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
astrodud cd252fa3c2 forgot to add transformVector3 function (used by LatheObject.js) 2011-01-08 21:41:27 -08:00
Mr.doob d5a2122598 Merge remote branch 'alteredq/master' 2011-01-09 02:47:06 +00:00
Mr.doob 5153379a5b Merge remote branch 'astrodud/master' 2011-01-09 02:46:56 +00:00
alteredq e43de3dcf7 Refactored lines handling in WebGLRenderer to use the same internal machinery as meshes.
No need to stuff them in different bucket, line-specific stuff is anyway done in `renderBuffer` method.

This was prompted by starting with implementation of ParticleSystem. It would be unwieldy to handle three different buckets of objects / buffers.
2011-01-08 17:33:55 +01:00
astrodud ea9492b882 added LathedObject which creates a geometry by rotating a set of Vertices around the z axis. UV mapping is supported. See http://astrodud.isgreat.org/asteroids for an example. 2011-01-07 21:47:37 -08: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 ef9bdf6b77 Small WebGLRenderer optimization: skip setting of uniforms which don't exist in shader program. 2011-01-06 02:57:05 +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