Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Optimize Collision Detection with Octree
Search
yomotsu
October 08, 2014
Programming
0
710
Optimize Collision Detection with Octree
yomotsu
October 08, 2014
Tweet
Share
More Decks by yomotsu
See All by yomotsu
three.jsとRapierでレースゲームが3日でできた話
yomotsu
0
390
PBR in three.js
yomotsu
1
830
dialog要素でつくるモーダルダイアログ
yomotsu
0
960
IE to Edge
yomotsu
1
320
A Camera Control Library for three.js
yomotsu
1
1.1k
Let’s try AR on mobile Web with <model-viewer>
yomotsu
0
530
WebXR: Beyond WebGL
yomotsu
2
1.7k
Non-DOM components with WebGL in Vue.js
yomotsu
5
12k
WebGL Libs for WebApp Frameworks
yomotsu
4
7.8k
Other Decks in Programming
See All in Programming
快速入門可觀測性
blueswen
0
410
AppRouterを用いた大規模サービス開発におけるディレクトリ構成の変遷と問題点
eiganken
1
160
php-conference-japan-2024
tasuku43
0
360
良いユニットテストを書こう
mototakatsu
8
3.1k
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
190
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
740
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
2
460
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
210
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
340
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
290
fs2-io を試してたらバグを見つけて直した話
chencmd
0
240
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
260
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
530
Optimising Largest Contentful Paint
csswizardry
33
3k
Building Applications with DynamoDB
mza
91
6.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
The Cult of Friendly URLs
andyhume
78
6.1k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Speed Design
sergeychernyshev
25
680
Into the Great Unknown - MozCon
thekraken
34
1.5k
Code Reviewing Like a Champion
maltzj
521
39k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Transcript
1 Optimize Collision Detection with Octree Presented by Akihiro Oyamada
(@yomotsu) Frontend Engineer at PixelGrid, Inc. Oct 7, 2014
2
3
4
5
6
7 Collision Detection vs 524 Tris
8 vs only about 30 Tris by partitioning
ׂۭͨؒ͠ .PSUPOPSEFSʹैͬͯฒΔ 9
10
11
12
13
14
15 // maxDepth4のoctreeのツリー構成例 ! octree.nodes = [ [node], //level 1
(node*1個) [node,node...] //level 2 (node*8個) [node,node...] //level 3 (node*64個) [node,node...] //level 4 (node*512個) ]
16 // node単体の構成例 ! OctreeNode = function ( params )
{ ! this.tree // <Octree> this.depth // <Number> this.mortonNumber // <Number> this.min // <THREE.Vector3> this.max // <THREE.Vector3> this.trianglePool // <Array> ! }
17 -FWFMͷͷࢠϊʔυΛٻΊΔʹʜ
18 var i; ! var parentMotonNum = 1; ! for
( i = 0; i < 8; i ++ ) { ! console.log( ( parentMotonNum << 3 ) + i ); ! } ! // 8, 9, 10, 11, 12, 14, 15
19 -FWFMͷͷϊʔυΛٻΊΔʹʜ
20 var childMotonNum = 10; console.log( childMotonNum >> 3 );
! // 1
ϏοτγϑτͰ ٻΊΒΕΔ 21
ϊʔυʹܗͷ τϥΠΞϯάϧΛొ͢Δ 22
""##WT5SJBOHMF ϊʔυ""## 23
24
25
NBY%FQUIΛʹͨ͠Β $ISPNF͕ࢭ·ͬͨ ? ? ? ʜ ? ݸͷϊʔυ͕Ͱ͖Δ 26
܁Γฦ͠ͷΛݮΒ͢͜ͱ͕Ͱ͖ ͨ 27
%Ͱ͋Δ͚ΕͲɺ ܗฏ໘ʹ͍ۙͷͰɺ 2VBEUSFF % Ͱ͍͍͔ .PSUPO/VNͱϏοτγϑτ 28
• THREE.RayΛΊͯɺಠࣗͷ Segment-Triangleަࠩςετʹஔ͖͑ • ίϝϯτΛେྔʹೖΕͨ(ຊޠ͚ͩͲ) 29 ଞʹͬͨ͜ͱ
30 gl.finish(); @yomotsu