Dynamic terrain example now creates a specular texture from the color texture. That saves 2.17 MB download.
Just I had to drop materials pre-initialization, for some reason this doesn't play nice with having extra scene / render target :S.
In theory also detail normal texture could be computed from the color texture, just we need some nicer normal map filter (Gimp plugin has 9 different ones).
* Added support to texture.offset in CanvasRenderer
* Removed ShadowVolume, ShadowVolumeDynamicMaterial and LensFlare classes.
* Removed Stencil Shadows and LensFlare code out of WebGLRenderer
* Added 2.59 folder to Blender, and removed old ones.
Changed normal map shader to multiply specular component with diffuse weighting as specular highlights were appearing in the dark parts.
Changed camera look speed in minecraft and terrain demos, they were too fast - I guess as everything got faster with antialiasing off.
Reenabled antialiasing in few demos where it was too ugly without (basically anything with lines and without postprocessing).
Fixed again spurious invisible characters in empaempa's code (which are breaking everything and are hard to hunt as they look like spaces).
- Fixed TorusKnot face orientation.
- Added UVs to Cylinder (Cylindrical Mapping)
- Fixed Lathe UVs
There is something wrong with texture mapping, u needs to be inverted all the time. Something to researching on.
Work in progress, caveats:
- sort happens just inside one ParticleSystems, so everything gets messed up when more ParticleSystems are in the same screen space
- not yet solved proper order of operations, if you change object transform, you need to update ParticleSystem object matrix manually before rendering (so that sort works, otherwise it will use transform from previous frame)
Also fixed transparency in fog and did small optimizations in WebGLRenderer.
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.
A lot of things going on in this commit:
- added tangents computation for geometries
- mesh must have UV coordinates
- to be called explicitly once geometry is loaded like this: geometry.computeTangents()
- tangents are stored in Vertex objects
- quads are not solved properly (though workaround hack seems to work at least somehow, as far as each vertex appears at least somewhere)
- extended VBOs in WebGLRenderer to include tangent streams (when available)
- added "normal" shader to ShaderUtils (to be used with MeshShaderMaterial)
- Blinn-Phong with one directional and one point light (7 varyings gone, just one spare)
- normal maps are in tangent space
- displacement maps use simple luminance value (could be changed if better precision is needed)
- displacement mapping uses vertex texture fetch
- this requires GPU with Shader Model 3.0
- not currently supported in ANGLE
- for this, added "supportsVertexTextures" method to WebGLRenderer API, so that application can handle this
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