diff --git a/examples/js/postprocessing/SSAOPass.js b/examples/js/postprocessing/SSAOPass.js index 2421514f760df693f939802d361bfa450aa67c12..04c567ff08197fb11893c47ac96c28cd27068815 100644 --- a/examples/js/postprocessing/SSAOPass.js +++ b/examples/js/postprocessing/SSAOPass.js @@ -369,19 +369,26 @@ THREE.SSAOPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), var simplex = new SimplexNoise(); var size = width * height; - var data = new Float32Array( size ); + var data = new Float32Array( size * 4 ); for ( var i = 0; i < size; i ++ ) { + var stride = i * 4; + var x = ( Math.random() * 2 ) - 1; var y = ( Math.random() * 2 ) - 1; var z = 0; - data[ i ] = simplex.noise3d( x, y, z ); + var noise = simplex.noise3d( x, y, z ); + + data[ stride ] = noise; + data[ stride + 1 ] = noise; + data[ stride + 2 ] = noise; + data[ stride + 3 ] = 1; } - this.noiseTexture = new THREE.DataTexture( data, width, height, THREE.LuminanceFormat, THREE.FloatType ); + this.noiseTexture = new THREE.DataTexture( data, width, height, THREE.RGBA, THREE.FloatType ); this.noiseTexture.wrapS = THREE.RepeatWrapping; this.noiseTexture.wrapT = THREE.RepeatWrapping; this.noiseTexture.needsUpdate = true;