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
770
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
770
PBR in three.js
yomotsu
1
1k
dialog要素でつくるモーダルダイアログ
yomotsu
0
1k
IE to Edge
yomotsu
1
370
A Camera Control Library for three.js
yomotsu
1
1.4k
Let’s try AR on mobile Web with <model-viewer>
yomotsu
0
580
WebXR: Beyond WebGL
yomotsu
2
1.9k
Non-DOM components with WebGL in Vue.js
yomotsu
5
13k
WebGL Libs for WebApp Frameworks
yomotsu
4
7.9k
Other Decks in Programming
See All in Programming
並行開発のためのコードレビュー
miyukiw
0
140
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
130
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
130
今から始めるClaude Code超入門
448jp
8
8.7k
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
3.9k
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
190
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
610
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
620
AI時代の認知負荷との向き合い方
optfit
0
160
CSC307 Lecture 07
javiergs
PRO
0
550
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
180
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
230
Featured
See All Featured
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
910
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.1k
Designing Experiences People Love
moore
144
24k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
66
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Prompt Engineering for Job Search
mfonobong
0
160
Thoughts on Productivity
jonyablonski
74
5k
Discover your Explorer Soul
emna__ayadi
2
1.1k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
50
A better future with KSS
kneath
240
18k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Darren the Foodie - Storyboard
khoart
PRO
2
2.4k
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