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
Basic 3D Math for ARKit
Search
KBOY
September 15, 2018
Technology
1
750
Basic 3D Math for ARKit
KBOY
September 15, 2018
Tweet
Share
More Decks by KBOY
See All by KBOY
How to make Stripe and RevenueCat coexist in an app
fujikawakei
0
120
iOS15から使えるScreenTimeAPIをFlutterアプリで動かす
fujikawakei
0
140
FlutterエンジニアがFlutterFlowを使ってみた感想
fujikawakei
0
140
Flutterと課金
fujikawakei
0
140
【スタートアップ開発者必見】firebaseとalgoliaとstripeで1人で本格的なiOSアプリを作る方法
fujikawakei
2
590
ARCore-Kotlin-Sampler作ってきました
fujikawakei
0
270
ARKitのための3D算数
fujikawakei
3
4.6k
ARKitでお絵かきする方法2選
fujikawakei
0
1.9k
assertion を積極的に使って 役立った話
fujikawakei
0
2k
Other Decks in Technology
See All in Technology
Agile PBL at New Grads Trainings
kawaguti
PRO
1
380
AWSを利用する上で知っておきたい名前解決のはなし(10分版)
nagisa53
9
2.9k
初めてAWSを使うときのセキュリティ覚書〜初心者支部編〜
cmusudakeisuke
1
210
ハードウェアとソフトウェアをつなぐ全てを内製している企業の E2E テストの作り方 / How to create E2E tests for a company that builds everything connecting hardware and software in-house
bitkey
PRO
1
110
大「個人開発サービス」時代に僕たちはどう生きるか
sotarok
20
9.6k
5年目から始める Vue3 サイト改善 #frontendo
tacck
PRO
3
210
フィンテック養成勉強会#56
finengine
0
140
COVESA VSSによる車両データモデルの標準化とAWS IoT FleetWiseの活用
osawa
1
250
20250903_1つのAWSアカウントに複数システムがある環境におけるアクセス制御をABACで実現.pdf
yhana
3
530
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
8.7k
未経験者・初心者に贈る!40分でわかるAndroidアプリ開発の今と大事なポイント
operando
3
270
「どこから読む?」コードとカルチャーに最速で馴染むための実践ガイド
zozotech
PRO
0
240
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.6k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
800
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Music & Morning Musume
bryan
46
6.8k
GraphQLとの向き合い方2022年版
quramy
49
14k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
Visualization
eitanlees
148
16k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
187
55k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
RailsConf 2023
tenderlove
30
1.2k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Transcript
Basic 3D Mathematics for ARKit Kei Fujikawa 2018.9.15@Tokyo iOS Meetup
Who?
Who?
Why is ے?
Spajam 2nd Prized Best Body Japan Held ے.swift Showing in Article Smooth-sailing?
Not so easy.
A bunch of ے
ے 4FOHPLV1FSJPE
AR!
Question!
Spajam 2nd Prized Best Body Japan Held ے.swift Showing in Article
I have to ride on this big wave.
So,
I joined AR startup this January
Graffity Inc.
Apps we’re making
I studied ARKit for so much time
Not so easy.
Let’s think about this example.
Place an airplane at the 30cm in front of screen’s
touched point.
None
Looks way too easy
Getting x,y from touch gesture and Z is 0.3?
Finally
None
It does not show
Ideal
None
Real
None
Not so easy
So,
I studied 3D programming.
Books I read for study IUUQTBN[OUP.4V.F( IUUQTBN[OUP1,'Z5
So,
Today I will explain 3D Programming clearly.
Basic 3D Mathematics for ARKit Kei Fujikawa 2018.9.15@Tokyo iOS Meetup
Today’s goal
Place an airplane at the 30cm in front of screen’s
touched point.
None
We will study •Coordinate systems •Method for coordinate transformation
Coordinate system for ARKit
Coordinates World Object Camera Screen Drawn by iPad Pro
World Coordinate system The biggest coordinates In your iPhone
Object Coordinate system Airplane’s own coordinate
Camera coordinate system ΧϝϥͷϩʔΧϧ࠲ඪ
Camera
Screen
Screen
Coordinates World Object Camera Screen Drawn by iPad Pro
Let’s check the Goal
Place an airplane at the 30cm in front of screen’s
touched point.
30cm Get x,y from tap gesture Place the object In
the world. Place at 30cm In front of camera Convert to world ᶃ ᶄ ᶅ Convert to Screen ᶆ ᶄ’ Convert to screen
ᶃPlace at 30cm in front of camera Minus 30cm
None
ᶄConvert to World
Convert from a coordinate to a coordinate
ᶄ’Convert to screen
World <-> Screen
ᶅGet x,y from tap gesture
ᶆPlace in the world
Screen <-> World
At 30cm Tapped position Convert Convert
Calculate at easy coordinate system
By the way
You can do it all in the screen coordinate
30cm Get x,y from tap gesture Place the object In
the world. Place at 30cm In front of camera Convert to world ᶃ ᶄ ᶅ Convert to Screen ᶆ ᶄ’ Convert to screen Removable
Removabl
It looks easier!!
Yes
You can code shorter
None
But
In fact
This 0.996 is Same with 0.3m in camera coordinate
What is 0.996?
Review for coordinate system
0.0 1.0 Screen’s z 0.001m 1000m Camera’s z
Screen’s Z
https://developer.apple.com/documentation/scenekit/scnscenerenderer/1522631-unprojectpoint Z is 0.0~1.0
Camera’s Z?
None
None
None
debug
None
Z is 0.01~1000
Let’s change zNear.
None
0.0 1.0 Screen’s z 0.001m 1000m Camera’s z
Screen’s z vs Camera’s 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...
Way too hassle
Removable?
Must
So,
Understanding Coordinate’s system And..
None
Make sense?
Let’s study more?
Make a airplane Bigger or Rotation
Scale
Rotate by SCNVector4 Axis Degree
Rotate by Euler angle
Rotate by Euler angle x
Rotate by Euler angle Y
Rotate by Euler angle Z
x Y Z
That’s it
One more thing.
Making ARKit 2.0 repository
End