Skip to content

Commit b2c26af

Browse files
donmccurdyDon McCurdy
authored andcommitted
LightProbeVolume: Clamp sample positions to grid volume.
1 parent 760d959 commit b2c26af

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

examples/jsm/lights/LightProbeVolume.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ LightProbeVolume.prototype = Object.assign( Object.create( Object3D.prototype ),
154154
mesh.getWorldPosition( position );
155155
this.worldToLocal( position );
156156

157+
// Cheap, approximate extrapolation. A better method is described in the
158+
// Cupisz talk at GDC 2012.
159+
position.clamp( this.bounds.min, this.bounds.max );
160+
157161
var cellIndex = this._findCell( mesh, position );
158162

159163
if ( cellIndex === undefined ) return this;

0 commit comments

Comments
 (0)