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
ARKitのための3D算数
Search
KBOY
August 30, 2018
Programming
3
4.4k
ARKitのための3D算数
iOSDC 2018
KBOY
August 30, 2018
Tweet
Share
More Decks by KBOY
See All by KBOY
How to make Stripe and RevenueCat coexist in an app
fujikawakei
0
50
iOS15から使えるScreenTimeAPIをFlutterアプリで動かす
fujikawakei
0
100
FlutterエンジニアがFlutterFlowを使ってみた感想
fujikawakei
0
110
Flutterと課金
fujikawakei
0
100
【スタートアップ開発者必見】firebaseとalgoliaとstripeで1人で本格的なiOSアプリを作る方法
fujikawakei
2
530
ARCore-Kotlin-Sampler作ってきました
fujikawakei
0
230
Basic 3D Math for ARKit
fujikawakei
1
630
ARKitでお絵かきする方法2選
fujikawakei
0
1.7k
assertion を積極的に使って 役立った話
fujikawakei
0
1.9k
Other Decks in Programming
See All in Programming
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
2
660
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
860
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
220
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.1k
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
Contemporary Test Cases
maaretp
0
130
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
290
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Speed Design
sergeychernyshev
24
610
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
KATA
mclloyd
29
14k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Optimizing for Happiness
mojombo
376
70k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Transcript
ARKitͷͨΊͷ 3Dࢉ KBOY@ےΤϯδχΞ 2018.8.30@iOSDC 2018
ࣗݾհ ૣҴా͕ߍͰ͢
ےΤϯδχΞͷܦྺ
݄ ݄ ݄ ݄ ݄
Spajam༏ल ϕετϘσΟδϟύϯग़ ے.swift։࠵ స৬υϥϑτग़ԋ ॱ෩ຬൕʂʁ
͔ͦ͠͠͏͘ͳ͍
ےΤϯδχΞͷ಄
ےΤϯδχΞ ઓࠃ࣌
ͦ͏ͩʂARͩʂ
݄ ݄ ݄ ݄ ݄
Spajam༏ल ϕετϘσΟδϟύϯग़ స৬υϥϑτग़ԋ ے.swift։࠵
Δ͔͠ͳ͍ ͜ͷϏοάΣʔϒʹ
ͱ͍͏͜ͱͰ
ࠓ1݄ʹ ARελʔτΞοϓJOIN
Graffity Inc. Ϧʔμʔ
͜ΜͳΞϓϦ࡞ͬͯ·͢
ͱ͍͏͜ͱͰARKitΛ ؤுͬͯษڧ͠·ͨ͠
͔͠͠ ͦ͏͘ͳ͍
͜͏͍͏ྫΛ ߟ͑ͯΈ·͠ΐ͏
εΫϦʔϯ্ͷλοϓͨ͠෦ͷ 30cmલʹ ඈߦػΛஔ͘
None
༨༟ͬ͠ΐʂ
λοϓδΣενϟʔ͔Β x, yΛऔಘ, z0.3mΛೖΕΕʂ
݁Ռ
None
શવग़ͯ͜ͳ͍…
ཧ
None
ݱ࣮
None
ͬͺΓ ͦ͏͘ͳ͍
ͦΜͳ࣌ɺϦʔμʔ͕ खΛࠩ͠৳ͯ͘Εͨ
3DϓϩάϥϛϯάΛ ษڧ͢Ε༨༟ͩΑ
Ϧʔμʔʂʂ
ͦͯ͠
3Dϓϩάϥϛϯά Λษڧͨ͠ɻ
ษڧʹͬͨຊ IUUQTBN[OUP.4V.F( IUUQTBN[OUP1,'Z5
ͱ͍͏͜ͱͰ
ࠓօ͞Μʹ Θ͔Γ͘͢ 3DϓϩάϥϛϯάΛ આ໌͠·͢
ARKitͷͨΊͷ 3Dࢉ KBOY@ےΤϯδχΞ 2018.8.30@iOSDC 2018
ࠓͷΰʔϧ
εΫϦʔϯ্ͷλοϓͨ͠෦ͷ 30cmલʹ ඈߦػΛஔ͘
None
ษڧ͢Δ͜ͱ •࠲ඪܥΛΔ •࠲ඪมͷϝιουΛΔ
ARKitͰ͏࠲ඪܥ
࠲ඪ·ͱΊ ϫʔϧυ࠲ඪܥ ΦϒδΣΫτ࠲ඪܥ Χϝϥ࠲ඪܥ εΫϦʔϯ࠲ඪܥ iPad ProͰॻ͖·ͨ͠ɻ
ϫʔϧυ࠲ඪܥ ͜ΕΑΓେ͖ͳ֎ଆͷ ࠲ඪۭؒͰදݱͰ͖ͳ͍
ΦϒδΣΫτ࠲ඪܥ ඈߦػࣗͷϩʔΧϧ࠲ඪʂ
Χϝϥ࠲ඪܥ ΧϝϥͷϩʔΧϧ࠲ඪ
Χϝϥ࠲ඪܥ
εΫϦʔϯ࠲ඪܥ
εΫϦʔϯ࠲ඪܥ
࠲ඪ·ͱΊ ϫʔϧυ࠲ඪܥ ΦϒδΣΫτ࠲ඪܥ Χϝϥ࠲ඪܥ εΫϦʔϯ࠲ඪܥ iPad ProͰॻ͖·ͨ͠ɻ
ΰʔϧͷ֬ೝ
εΫϦʔϯ্ͷλοϓͨ͠෦ͷ 30cmલʹ ඈߦػΛஔ͘
30cm εΫϦʔϯλοϓͷ xy࠲ඪऔಘ ϫʔϧυ࠲ඪʹมͯ͠ ͦ͜ʹஔ͘ʂ Χϝϥͷ30cmલʹஔ͘ ϫʔϧυ࠲ඪʹม ᶃ ᶄ ᶅ
εΫϦʔϯ࠲ඪʹม ᶆ ᶄ’ εΫϦʔϯ࠲ඪʹม
ᶃΧϝϥ࠲ඪͰ30cmલʹஔ͘ ϚΠφε 30cm
None
ᶄϫʔϧυ࠲ඪʹม
͋Δ࠲ඪܥ͔Β ͋Δ࠲ඪܥ มͰ͖Δ
ᶄ’εΫϦʔϯ࠲ඪʹม
ϫʔϧυ࠲ඪܥ→εΫϦʔϯ࠲ඪܥ
ᶅεΫϦʔϯλοϓͷxy࠲ඪऔಘ
ᶆϫʔϧυ࠲ඪʹมͯ͠ஔ͘
εΫϦʔϯ࠲ඪܥ→ϫʔϧυ࠲ඪܥ
30cmલ λοϓͨ͠Ґஔ ม ม
ͦΕͧΕɺ߹ͷ͍͍ ࠲ඪܥͰܭࢉ͢Δ
ͪͳΈʹ
εΫϦʔϯ࠲ඪܥ͚ͩ ͰશͯΛදݱͰ͖Δ
εΫϦʔϯλοϓͷ xy࠲ඪऔಘ ϫʔϧυ࠲ඪʹมͯ͠ ͦ͜ʹஔ͘ʂ Χϝϥͷ30cmલʹஔ͘ ϫʔϧυ࠲ඪʹม ᶃ ᶄ ᶅ εΫϦʔϯ࠲ඪʹม
ᶆ ᶄ’ εΫϦʔϯ࠲ඪʹม ͜͜ল͚Δ 30cm
͜͜ল͚Δ
ͬͪ͜ͷํָ͕͡ΌΜʂ
͔ͨ͠ʹ
͜ͷ͍ίʔυͰߦ͚Δ
None
Ͱ
࣮
͜ͷ0.996 Χϝϥ࠲ඪܥͷ0.3mͱ ಉ͡ҙຯ
0.996ͱ
͜͜Ͱ࠲ඪܥͷ෮श
0.0 1.0 εΫϦʔϯ࠲ඪܥͷ z 0.001m 1000m Χϝϥ࠲ඪܥͷ z
εΫϦʔϯ࠲ඪܥͷz
https://developer.apple.com/documentation/scenekit/scnscenerenderer/1522631-unprojectpoint εΫϦʔϯ࠲ඪܥͷ z0.0~1.0
Χϝϥ࠲ඪܥͷzʁ
None
None
None
debugͯ͠ΈΔͱ
None
zNearΛ มԽͤͯ͞ΈΑ͏
None
0.0 1.0 εΫϦʔϯ࠲ඪܥͷ z 0.001m 1000m Χϝϥ࠲ඪܥͷ z
εΫϦʔϯ࠲ඪͷz vs Χϝϥ࠲ඪͷz
http://www.alecjacobson.com/weblog/?p=3835 -0.001 -1000 0.996 screenZ = f(n + cameraZ)/((f −
n)cameraZ) -0.3 screenZ cameraZ
screenZ = f(n + cameraZ)/((f − n)cameraZ) screenZ = 1000(0.001
+ (−0.3))/((1000 − 0.002)(−0.3)) f = 1000 n = 0.001 cameraZ = − 0.3 screenZ = 0.9966...
࣮ʹ໘͍͘͞
͜͜ল͚Δʂʁ
ඞཁʂ
ͱ͍͏͜ͱͰ
࠲ඪมΛۦͯ͠
None
ʂ
͏ͪΐ͍ͬͯΈ·͠ΐ͏ʂ
ඈߦػΛ֦େͨ͠Γɺ ճసͤ͞Α͏ʂ
֦େɾॖখ
ճస (SCNVector4) ࣠ ֯
ճస(Euler angle)
ճస (Euler angle) x
ճస (Euler angle) Y
ճస (Euler angle) Z
x Y Z
Ҏ্
͜͜·Ͱ͕ࢉ
·ֶ͕ͩ͋Γ·͢ɻ
Ͱ
࠲ඪͷ֓೦Λཧղͯ͠ SceneKitARKitΛ ͍͜ͳͤΕྑ͍ɻ
ֶʹ͍ͭͯQiitaͰɻ
ARKitͷͨΊͷ 3D ֶ
ࠂ
Graffity Inc. ΤϯδχΞืूதʂ
࠷ޙʹ
ݸਓͰARKitͷಈըڭࡐ࡞த
One More Thing
ࠓΓ·͢ .kt
ے.kt w :BIPP-PEHF w ݄
͓ΘΓ