I finally found the solution myself. There was no issue with three.js at all, the actual problem was that I accidentially added several planes into one scene instead of just one. That was because my initScene() method got called more than just once since I didn't check the case when all the shaders etc. are still loading (I'm loading my shaders via an async AJAX request). I just checked for 'isn't loaded at all' and 'is completely loaded and ready to use'.
This is working now:
/**
* Adds geometry to the scene and attaches previously loaded material.
*
* @param {Number} wavelength of the first octave of the height map
* @param {Number} frequency of the first octave of the height map
* @param {Number} number of octaves (has to be an integer)
*/
HeightMap.prototype.initScene = function(wavelength, frequency, lacunarity, persistency, octaves) {
this.material = HeightMap.settings.templateMaterial.clone();
this.updateUniforms(wavelength, frequency, lacunarity, persistency, octaves);
HeightMapOctave.prototype.addPlane.call(this);
this.initialized = true;
};
/**
* Updates values for HeightMap.
*
* @param {Number} wavelength of the first octave of the height map
* @param {Number} frequency of the first octave of the height map
* @param {Number} number of octaves (has to be an integer)
*/
HeightMap.prototype.updateScene = function(wavelength, frequency, lacunarity, persistency, octaves) {
if (this.initialized) {
this.updateUniforms(wavelength, frequency, lacunarity, persistency, octaves);
Canvas3D.prototype.render.call(this);
} else if (!this.initializing) {
this.initializing = true;
this.loadShaders(function() {
this.initScene(wavelength, frequency, lacunarity, persistency, octaves);
Canvas3D.prototype.render.call(this);
});
}
};
I know this was a very specific problem, but maybe this post might still be helpful for others who make the same mistake. It took me basically a week to track this bug down...