ARKitのための3D算数

4f1a55d79f969b8a75f64ee4bd9a99c1?s=47 KBOY
August 30, 2018

 ARKitのための3D算数

iOSDC 2018

4f1a55d79f969b8a75f64ee4bd9a99c1?s=128

KBOY

August 30, 2018
Tweet

Transcript

  1. ARKitͷͨΊͷ 3Dࢉ਺ KBOY@ے೑ΤϯδχΞ 2018.8.30@iOSDC 2018

  2. ࣗݾ঺հ ૣҴా͕฼ߍͰ͢

  3. ے೑ΤϯδχΞͷܦྺ

  4.      ೥݄ ݄ ݄ ೥݄ ೥݄

    Spajam༏ल৆ ϕετϘσΟδϟύϯग़৔ ے೑.swift։࠵ స৬υϥϑτग़ԋ ॱ෩ຬൕʂʁ
  5. ͔ͦ͠͠͏؁͘͸ͳ͍

  6. ے೑ΤϯδχΞͷ୆಄

  7. ے೑ΤϯδχΞ ઓࠃ࣌୅

  8. ͦ͏ͩʂARͩʂ

  9.      ೥݄ ݄ ݄ ೥݄ ೥݄

    Spajam༏ल৆ ϕετϘσΟδϟύϯग़৔ స৬υϥϑτग़ԋ ے೑.swift։࠵
  10. ৐Δ͔͠ͳ͍ ͜ͷϏοά΢Σʔϒʹ

  11. ͱ͍͏͜ͱͰ

  12. ࠓ೥1݄ʹ ARελʔτΞοϓ΁JOIN

  13. Graffity Inc. Ϧʔμʔ

  14. ͜ΜͳΞϓϦ࡞ͬͯ·͢

  15. ͱ͍͏͜ͱͰARKitΛ ؤுͬͯษڧ͠·ͨ͠

  16. ͔͠͠ ͦ͏؁͘͸ͳ͍

  17. ͜͏͍͏ྫΛ ߟ͑ͯΈ·͠ΐ͏

  18. εΫϦʔϯ্ͷλοϓͨ͠෦෼ͷ 30cmલʹ ඈߦػΛஔ͘

  19. None
  20. ༨༟ͬ͠ΐʂ

  21. λοϓδΣενϟʔ͔Β x, yΛऔಘ, z͸0.3mΛೖΕΕ͹׬੒ʂ

  22. ݁Ռ

  23. None
  24. શવग़ͯ͜ͳ͍…

  25. ཧ૝

  26. None
  27. ݱ࣮

  28. None
  29. ΍ͬͺΓ ͦ͏؁͘͸ͳ͍

  30. ͦΜͳ࣌ɺϦʔμʔ͕ खΛࠩ͠৳΂ͯ͘Εͨ

  31. 3DϓϩάϥϛϯάΛ ษڧ͢Ε͹༨༟ͩΑ

  32. Ϧʔμʔʂʂ

  33. ͦͯ͠๻͸

  34. 3Dϓϩάϥϛϯά Λษڧͨ͠ɻ

  35. ษڧʹ࢖ͬͨຊ IUUQTBN[OUP.4V.F( IUUQTBN[OUP1,'Z5

  36. ͱ͍͏͜ͱͰ

  37. ࠓ೔͸օ͞Μʹ Θ͔Γ΍͘͢ 3DϓϩάϥϛϯάΛ આ໌͠·͢

  38. ARKitͷͨΊͷ 3Dࢉ਺ KBOY@ے೑ΤϯδχΞ 2018.8.30@iOSDC 2018

  39. ࠓ೔ͷΰʔϧ

  40. εΫϦʔϯ্ͷλοϓͨ͠෦෼ͷ 30cmલʹ ඈߦػΛஔ͘

  41. None
  42. ษڧ͢Δ͜ͱ •࠲ඪܥΛ஌Δ •࠲ඪม׵ͷϝιουΛ஌Δ

  43. ARKitͰ࢖͏࠲ඪܥ

  44. ࠲ඪ·ͱΊ ϫʔϧυ࠲ඪܥ ΦϒδΣΫτ࠲ඪܥ Χϝϥ࠲ඪܥ εΫϦʔϯ࠲ඪܥ iPad ProͰॻ͖·ͨ͠ɻ

  45. ϫʔϧυ࠲ඪܥ ͜ΕΑΓେ͖ͳ֎ଆͷ ࠲ඪۭؒͰදݱͰ͖ͳ͍

  46. ΦϒδΣΫτ࠲ඪܥ ඈߦػࣗ਎ͷϩʔΧϧ࠲ඪʂ

  47. Χϝϥ࠲ඪܥ ΧϝϥͷϩʔΧϧ࠲ඪ

  48. Χϝϥ࠲ඪܥ

  49. εΫϦʔϯ࠲ඪܥ

  50. εΫϦʔϯ࠲ඪܥ

  51. ࠲ඪ·ͱΊ ϫʔϧυ࠲ඪܥ ΦϒδΣΫτ࠲ඪܥ Χϝϥ࠲ඪܥ εΫϦʔϯ࠲ඪܥ iPad ProͰॻ͖·ͨ͠ɻ

  52. ΰʔϧͷ֬ೝ

  53. εΫϦʔϯ্ͷλοϓͨ͠෦෼ͷ 30cmલʹ ඈߦػΛஔ͘

  54. 30cm εΫϦʔϯλοϓͷ xy࠲ඪऔಘ ϫʔϧυ࠲ඪʹม׵ͯ͠ ͦ͜ʹஔ͘ʂ Χϝϥͷ30cmલʹஔ͘ ϫʔϧυ࠲ඪʹม׵ ᶃ ᶄ ᶅ

    εΫϦʔϯ࠲ඪʹม׵ ᶆ ᶄ’ εΫϦʔϯ࠲ඪʹม׵
  55. ᶃΧϝϥ࠲ඪͰ30cmલʹஔ͘ ϚΠφε 30cm

  56. None
  57. ᶄϫʔϧυ࠲ඪʹม׵

  58. ͋Δ࠲ඪܥ͔Β ͋Δ࠲ඪܥ΁ ม׵Ͱ͖Δ

  59. ᶄ’εΫϦʔϯ࠲ඪʹม׵

  60. ϫʔϧυ࠲ඪܥ→εΫϦʔϯ࠲ඪܥ

  61. ᶅεΫϦʔϯλοϓͷxy࠲ඪऔಘ

  62. ᶆϫʔϧυ࠲ඪʹม׵ͯ͠ஔ͘

  63. εΫϦʔϯ࠲ඪܥ→ϫʔϧυ࠲ඪܥ

  64. 30cmલ λοϓͨ͠Ґஔ ม׵ ม׵

  65. ͦΕͧΕɺ౎߹ͷ͍͍ ࠲ඪܥͰܭࢉ͢Δ

  66. ͪͳΈʹ

  67. εΫϦʔϯ࠲ඪܥ͚ͩ Ͱ΋શͯΛදݱͰ͖Δ

  68. εΫϦʔϯλοϓͷ xy࠲ඪऔಘ ϫʔϧυ࠲ඪʹม׵ͯ͠ ͦ͜ʹஔ͘ʂ Χϝϥͷ30cmલʹஔ͘ ϫʔϧυ࠲ඪʹม׵ ᶃ ᶄ ᶅ εΫϦʔϯ࠲ඪʹม׵

    ᶆ ᶄ’ εΫϦʔϯ࠲ඪʹม׵ ͜͜ল͚Δ 30cm
  69. ͜͜ল͚Δ

  70. ͬͪ͜ͷํָ͕͡ΌΜʂ

  71. ͔ͨ͠ʹ

  72. ͜ͷ୹͍ίʔυͰߦ͚Δ

  73. None
  74. Ͱ΋

  75. 

  76. ࣮͸

  77. ͜ͷ0.996͸ Χϝϥ࠲ඪܥͷ0.3mͱ ಉ͡ҙຯ

  78. 0.996ͱ͸

  79. ͜͜Ͱ࠲ඪܥͷ෮श

  80. 0.0 1.0 εΫϦʔϯ࠲ඪܥͷ z 0.001m 1000m Χϝϥ࠲ඪܥͷ z

  81. εΫϦʔϯ࠲ඪܥͷz

  82. https://developer.apple.com/documentation/scenekit/scnscenerenderer/1522631-unprojectpoint εΫϦʔϯ࠲ඪܥͷ z͸0.0~1.0

  83. Χϝϥ࠲ඪܥͷz͸ʁ

  84. None
  85. None
  86. None
  87. debugͯ͠ΈΔͱ

  88. None
  89. zNearΛ มԽͤͯ͞ΈΑ͏

  90. None
  91. 0.0 1.0 εΫϦʔϯ࠲ඪܥͷ z 0.001m 1000m Χϝϥ࠲ඪܥͷ z

  92. εΫϦʔϯ࠲ඪͷz vs Χϝϥ࠲ඪͷz

  93. http://www.alecjacobson.com/weblog/?p=3835 -0.001 -1000 0.996 screenZ = f(n + cameraZ)/((f −

    n)cameraZ) -0.3 screenZ cameraZ
  94. 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...
  95. ࣮ʹ໘౗͍͘͞

  96. ͜͜ল͚Δʂʁ

  97. ඞཁʂ

  98. ͱ͍͏͜ͱͰ

  99. ࠲ඪม׵Λۦ࢖ͯ͠

  100. None
  101. ׬੒ʂ

  102. ΋͏ͪΐ͍΍ͬͯΈ·͠ΐ͏ʂ

  103. ඈߦػΛ֦େͨ͠Γɺ ճసͤ͞Α͏ʂ

  104. ֦େɾॖখ

  105. ճస (SCNVector4) ࣠ ֯౓

  106. ճస(Euler angle)

  107. ճస (Euler angle) x

  108. ճస (Euler angle) Y

  109. ճస (Euler angle) Z

  110. x Y Z

  111. Ҏ্

  112. ͜͜·Ͱ͕ࢉ਺

  113. ·ͩ਺ֶ͕͋Γ·͢ɻ

  114. Ͱ΋

  115. ࠲ඪͷ֓೦Λཧղͯ͠ SceneKit΍ARKitΛ ࢖͍͜ͳͤΕ͹ྑ͍ɻ

  116. ਺ֶʹ͍ͭͯ͸QiitaͰɻ

  117. ARKitͷͨΊͷ 3D ਺ֶ

  118. ࠂ஌

  119. Graffity Inc. ΤϯδχΞืूதʂ

  120. ࠷ޙʹ

  121. ݸਓͰARKitͷಈըڭࡐ࡞੒த

  122. One More Thing

  123. ࠓ೥΋΍Γ·͢ .kt

  124. ے೑.kt w :BIPP-PEHF w ೥݄೔

  125. ͓ΘΓ