This is a workaround for Chrome ANGLE antialiasing issue manifested in geometry_terrain_fog demo:
http://twitpic.com/3iftyh
Problem happens in Chrome ANGLE when geometry is rendered with the same color as canvas background - then instead of expected nothing to be seen, there is a faint white outline at geometry borders.
This issue is not specific to fog, even just rendering geometry with MeshBasicMaterial having the same color as background produces the same outline.
TODO: create isolated test case and file ANGLE / Chromium bug.
For the moment, it works just on Basic / Lambert / Phong materials.
Fog must be added to the scene before initialization of WebGLRenderer and scene must be passed to WebGLRenderer constructor (like for lights).
I don't know yet how to solve properly MeshShaderMaterial & co :(
Instant performance boost in all cube mapping demos ;)
With panoramas there were insane amounts of unnecessary computations done in fragment shader - basically every pixel on the screen was computing the whole ubershader - ouch ouch ouch!
This was the lowest hanging fruit, still some more performance can be gained by removing other stuff from ubershader.
Big thanks to mrdoob for starting to question sanity of ubershader ;)
This one kept me puzzled for days. Premature optimization is indeed evil.
Manifestation was that MeshShaderMaterial mysteriously didn't work depending on what was going on elsewhere in the scene. I think mrdoob's problem with "basic" shader was caused by this bug.
For some reason it doesn't work with the current Chrome canary (10.0.607.0) when using ANGLE :(.
Also OBJ converter demo is having problems with generated tiled texture in latest canary, so it looks like some bug was introduced in ANGLE's handling of UVs (baked AO relies on "zoomed" UVs).
Need to investigate more, maybe file a bug report.
WebGLRenderer2: Trying to re-create WebGLRenderer from scratch... Creating a program per material instead of just one for everything. Seems to be 3x faster by now...
As suspected, this was caused by incorrect shader state management when switching between multiple shaders (thanks Firefox for verbose warnings).
Also, testing WebGL performance is very tricky. You can get different performance depending on the state of browsers / system (messed up state can be 10-66% slower):
1. freshly started Chrome can be much faster than Chrome that already ran few WebGL demos (which are now closed)
2. demo opened in new Chrome tab can be faster than demo reloaded in the same tab
3. even demos opened and closed in Firefox can slow down Chrome demos
This suggests that browsers do not clean GPU state properly :(