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.5k
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
60
iOS15から使えるScreenTimeAPIをFlutterアプリで動かす
fujikawakei
0
110
FlutterエンジニアがFlutterFlowを使ってみた感想
fujikawakei
0
120
Flutterと課金
fujikawakei
0
110
【スタートアップ開発者必見】firebaseとalgoliaとstripeで1人で本格的なiOSアプリを作る方法
fujikawakei
2
540
ARCore-Kotlin-Sampler作ってきました
fujikawakei
0
230
Basic 3D Math for ARKit
fujikawakei
1
650
ARKitでお絵かきする方法2選
fujikawakei
0
1.7k
assertion を積極的に使って 役立った話
fujikawakei
0
1.9k
Other Decks in Programming
See All in Programming
HTTP compression in PHP and Symfony apps
dunglas
2
1.7k
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
140
The rollercoaster of releasing an Android, iOS, and macOS app with Kotlin Multiplatform | droidcon Italy
prof18
0
150
フロントエンドのディレクトリ構成どうしてる? Feature-Sliced Design 導入体験談
osakatechlab
8
4.1k
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
3.9k
テストコード文化を0から作り、変化し続けた組織
kazatohiei
2
1.5k
As an Engineers, let's build the CRM system via LINE Official Account 2.0
clonn
1
670
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
180
CSC305 Lecture 25
javiergs
PRO
0
130
Security_for_introducing_eBPF
kentatada
0
110
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
510
Building Flexible Design Systems
yeseniaperezcruz
327
38k
What's in a price? How to price your products and services
michaelherold
243
12k
Code Review Best Practice
trishagee
65
17k
Building Your Own Lightsaber
phodgson
103
6.1k
Building Applications with DynamoDB
mza
91
6.1k
Side Projects
sachag
452
42k
Optimizing for Happiness
mojombo
376
70k
A Tale of Four Properties
chriscoyier
157
23k
Optimising Largest Contentful Paint
csswizardry
33
3k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
For a Future-Friendly Web
brad_frost
175
9.4k
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 ݄
͓ΘΓ