Skip to content

Commit f1d7a14

Browse files
committed
Improved webgl_postprocessing_ssao example.
1 parent cd0f294 commit f1d7a14

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

examples/webgl_postprocessing_ssao.html

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,21 @@
9090
camera.position.z = 500;
9191

9292
scene = new THREE.Scene();
93-
scene.background = new THREE.Color( 0xa0a0a0 );
93+
scene.background = new THREE.Color( 0xaaaaaa );
94+
95+
scene.add( new THREE.DirectionalLight() );
96+
scene.add( new THREE.HemisphereLight() );
9497

9598
group = new THREE.Group();
9699
scene.add( group );
97100

98-
var geometry = new THREE.IcosahedronBufferGeometry( 5, 3 );
99-
for ( var i = 0; i < 200; i ++ ) {
101+
var geometry = new THREE.BoxBufferGeometry( 10, 10, 10 );
102+
103+
for ( var i = 0; i < 100; i ++ ) {
100104

101-
var material = new THREE.MeshBasicMaterial();
102-
material.color.r = Math.random();
103-
material.color.g = Math.random();
104-
material.color.b = Math.random();
105+
var material = new THREE.MeshLambertMaterial( {
106+
color: Math.random() * 0xffffff
107+
} );
105108

106109
var mesh = new THREE.Mesh( geometry, material );
107110
mesh.position.x = Math.random() * 400 - 200;
@@ -111,7 +114,7 @@
111114
mesh.rotation.y = Math.random();
112115
mesh.rotation.z = Math.random();
113116

114-
mesh.scale.setScalar( Math.random() * 10 + 1 );
117+
mesh.scale.setScalar( Math.random() * 10 + 2 );
115118
group.add( mesh );
116119

117120
}
@@ -123,6 +126,7 @@
123126
var height = window.innerHeight;
124127

125128
ssaoPass = new THREE.SSAOPass( scene, camera, width, height );
129+
ssaoPass.kernelRadius = 16;
126130
ssaoPass.renderToScreen = true;
127131

128132
effectComposer = new THREE.EffectComposer( renderer );

0 commit comments

Comments
 (0)