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
680
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
120
PBR in three.js
yomotsu
1
730
dialog要素でつくるモーダルダイアログ
yomotsu
0
860
IE to Edge
yomotsu
1
280
A Camera Control Library for three.js
yomotsu
1
900
Let’s try AR on mobile Web with <model-viewer>
yomotsu
0
500
WebXR: Beyond WebGL
yomotsu
2
1.5k
Non-DOM components with WebGL in Vue.js
yomotsu
5
12k
WebGL Libs for WebApp Frameworks
yomotsu
4
7.7k
Other Decks in Programming
See All in Programming
今、知っておきたい! 生成AIエージェントの世界
elith
3
340
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
460
Ruby GitHub Packages
bkuhlmann
0
620
1BRC--Nerd Sniping the Java Community
gunnarmorling
0
300
単体テストを書かない技術 #phpcon_odawara
o0h
PRO
25
7.8k
Ruby Pattern Matching
bkuhlmann
0
920
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
100
ログラスを支える設計標準について / loglass-design-standards
urmot
10
2.1k
コードレビューで学ぶ!Kotlinオブジェクト指向デザインパターン
akkie76
2
180
二郎系ラーメンのコールで学ぶ AST 解析
memory1994
PRO
7
1.7k
Git Lint
bkuhlmann
4
740
PHPの次期バージョンはこの時期どうなっているのか - Internalsの開発体制について - PHPカンファレンス小田原
youkidearitai
PRO
1
180
Featured
See All Featured
Designing Experiences People Love
moore
136
23k
Facilitating Awesome Meetings
lara
41
5.6k
How STYLIGHT went responsive
nonsquared
92
4.8k
Reflections from 52 weeks, 52 projects
jeffersonlam
344
19k
How GitHub (no longer) Works
holman
304
140k
Fashionably flexible responsive web design (full day workshop)
malarkey
397
65k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
124
32k
The Illustrated Children's Guide to Kubernetes
chrisshort
29
46k
Building Adaptive Systems
keathley
30
1.8k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
119
38k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
356
22k
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