Skip to content

Commit 4562e8a

Browse files
authored
Examples: Improve webgpu_reflection_blurred performance (#31118)
* add resolution parameter * updates
1 parent 703631e commit 4562e8a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
-1.23 KB
Loading

examples/webgpu_reflection_blurred.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
const roughness = uniform( .9 );
125125
const radius = uniform( 0.2 );
126126

127-
const reflection = reflector( { resolution: 1, depth: true, bounces: false } ); // 0.5 is half of the rendering view
127+
const reflection = reflector( { resolution: .5, depth: true, bounces: false } ); // 0.5 is half of the rendering view
128128
const reflectionDepth = reflection.getDepthNode();
129129
reflection.target.rotateX( - Math.PI / 2 );
130130
scene.add( reflection.target );
@@ -141,6 +141,7 @@
141141
// blur the reflection
142142

143143
const reflectionBlurred = hashBlur( reflection, radiusRange, {
144+
repeats: 40,
144145
mask: reflectionDepth,
145146
premultipliedAlpha: true
146147
} );
@@ -183,6 +184,7 @@
183184
gui = new GUI();
184185
gui.add( roughness, 'value', 0, 1 ).name( 'roughness' );
185186
gui.add( radius, 'value', 0, 1 ).name( 'radius' );
187+
gui.add( reflection.reflector, 'resolution', .25, 1 ).name( 'resolution' );
186188

187189
stats = new Stats();
188190
document.body.appendChild( stats.dom );

0 commit comments

Comments
 (0)