From 7c1fc71ad96e6bbd90a14d81a57a049097d9c8ca Mon Sep 17 00:00:00 2001 From: Xander Luciano Date: Wed, 13 Jun 2018 12:07:29 -0700 Subject: [PATCH 1/5] Add computeBoundingSphere information Added information on calling computeBoundingSphere when updating BufferGeometry vertices to avoid strange side effects --- docs/manual/introduction/How-to-update-things.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/manual/introduction/How-to-update-things.html b/docs/manual/introduction/How-to-update-things.html index 50adc24132309d..cdb524157f471b 100644 --- a/docs/manual/introduction/How-to-update-things.html +++ b/docs/manual/introduction/How-to-update-things.html @@ -113,6 +113,17 @@

[page:BufferGeometry]

line.geometry.attributes.position.needsUpdate = true; // required after the first render + +

+ You should also call `.computeBoundingSphere()` on the object to recalculate the + the bounding sphere of the ojbect in order for raycasting and occlusion culling + to properly identify the boundary of your object. Otherwise you may end up with + an object that doesn't recieve raycast on the entire object, or is culled too + early when partially off the screen. +

+ +line.geometry.computeBoundingSphere(); +

[link:http://jsfiddle.net/w67tzfhx/ Here is a fiddle] showing an animated line which you can adapt to your use case. From 385fad51cee75934c11d69b23275cb6145f0feb2 Mon Sep 17 00:00:00 2001 From: Xander Luciano Date: Wed, 13 Jun 2018 14:15:40 -0700 Subject: [PATCH 2/5] Improved description Clarified issue scenario, and when this should be included. --- .../manual/introduction/How-to-update-things.html | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/manual/introduction/How-to-update-things.html b/docs/manual/introduction/How-to-update-things.html index cdb524157f471b..6b6a8bca198b99 100644 --- a/docs/manual/introduction/How-to-update-things.html +++ b/docs/manual/introduction/How-to-update-things.html @@ -115,14 +115,17 @@

[page:BufferGeometry]

- You should also call `.computeBoundingSphere()` on the object to recalculate the - the bounding sphere of the ojbect in order for raycasting and occlusion culling - to properly identify the boundary of your object. Otherwise you may end up with - an object that doesn't recieve raycast on the entire object, or is culled too - early when partially off the screen. + If you change the position data values after the initial render, you should also call + `.computeBoundingSphere()` on the object to recalculate it's bounding sphere. + The bounding sphere is used in calculations such as raycasting and frustrum culling. + If this method id not called after vertices are changed, you are likely to run into + strange side effects due to Three.js failing to properly identify the correct boundary + of your object. This may cause bugs succh as an object that doesn't properly + recieve raycasts on the entire object, or is frustrum culled too + early (such as when close to the edge of the screen).

-line.geometry.computeBoundingSphere(); +line.geometry.computeBoundingSphere(); // recommended after the first render

From fbc908f090f2f58f6fe14c230cf0797a7ed06aeb Mon Sep 17 00:00:00 2001 From: Xander Luciano Date: Wed, 13 Jun 2018 15:54:59 -0700 Subject: [PATCH 3/5] Removed extra words --- docs/manual/introduction/How-to-update-things.html | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/manual/introduction/How-to-update-things.html b/docs/manual/introduction/How-to-update-things.html index 6b6a8bca198b99..43d26ccbbc04c3 100644 --- a/docs/manual/introduction/How-to-update-things.html +++ b/docs/manual/introduction/How-to-update-things.html @@ -117,12 +117,6 @@

[page:BufferGeometry]

If you change the position data values after the initial render, you should also call `.computeBoundingSphere()` on the object to recalculate it's bounding sphere. - The bounding sphere is used in calculations such as raycasting and frustrum culling. - If this method id not called after vertices are changed, you are likely to run into - strange side effects due to Three.js failing to properly identify the correct boundary - of your object. This may cause bugs succh as an object that doesn't properly - recieve raycasts on the entire object, or is frustrum culled too - early (such as when close to the edge of the screen).

line.geometry.computeBoundingSphere(); // recommended after the first render From d5e3a594d3ffaef6b20b1cb31d6f80327cca019f Mon Sep 17 00:00:00 2001 From: Xander Luciano Date: Thu, 14 Jun 2018 14:41:50 -0700 Subject: [PATCH 4/5] reworded to clarify usage --- docs/manual/introduction/How-to-update-things.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/manual/introduction/How-to-update-things.html b/docs/manual/introduction/How-to-update-things.html index 43d26ccbbc04c3..225a1b96606c3d 100644 --- a/docs/manual/introduction/How-to-update-things.html +++ b/docs/manual/introduction/How-to-update-things.html @@ -115,8 +115,8 @@

[page:BufferGeometry]

- If you change the position data values after the initial render, you should also call - `.computeBoundingSphere()` on the object to recalculate it's bounding sphere. + If you change the position data values after the initial render, you may need to + call `.computeBoundingSphere()` in order to recalculate the geometry's bounding sphere.

line.geometry.computeBoundingSphere(); // recommended after the first render From e474d79b1ec78d34c2de05516de9a5abda96feaa Mon Sep 17 00:00:00 2001 From: Xander Luciano Date: Wed, 27 Jun 2018 10:24:42 -0700 Subject: [PATCH 5/5] Removed misleading recommendation --- docs/manual/introduction/How-to-update-things.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/manual/introduction/How-to-update-things.html b/docs/manual/introduction/How-to-update-things.html index 225a1b96606c3d..b7ca671b710926 100644 --- a/docs/manual/introduction/How-to-update-things.html +++ b/docs/manual/introduction/How-to-update-things.html @@ -119,7 +119,7 @@

[page:BufferGeometry]

call `.computeBoundingSphere()` in order to recalculate the geometry's bounding sphere.

-line.geometry.computeBoundingSphere(); // recommended after the first render +line.geometry.computeBoundingSphere();