Passthrough API - 2024-Adoor/practice GitHub Wiki
๊ด๋ จ ๊ณต์ ๋ฌธ์ ๋งํฌ:
๐ ์ด ๋ถ๋ถ์ Configure Unity Project์ ๋ฐํ์ผ๋ก ํฉ๋๋ค.
Tip
Building Blocks์ ํจ์ค์ค๋ฃจ ๋ธ๋ก์ ์ฌ์ฉํ๋ฉด ์ด ๊ณผ์ ์ ์๋์ผ๋ก ์งํํด ์ค๋๋ค.
-
OVRCameraRig์ ์ธ์คํํฐ์์...
- OVRManager ์ปดํฌ๋ํธ > Quest Features > General > Passthroguh Support์์ Required ๋๋ Supported ์ ํ
- Insight Passthrough์์ Enable Passthrough ํ์ฑํ
(๋์ค์ C# ์คํฌ๋ฆฝํธ๋ฅผ ํตํด ํจ์ค์ค๋ฃจ๋ฅผ initializeํ๋ ค๋ฉดOVRManager.isInsightPassthroughEnabled
๋ฅผ ์ด์ฉ ๊ฐ๋ฅ)
- ์ปดํฌ๋ํธ ์ถ๊ฐ > OVRPassthroughLayer ์คํฌ๋ฆฝํธ๋ฅผ ์ถ๊ฐ
- OVRPassthroughLayer์์ Projection Surface ์ค์ ์ ์ ํํ์ฌ ํจ์ค์ค๋ฃจ ๋ ๋๋ง์ด ์๋ ํ๊ฒฝ Depth ์ฌ๊ตฌ์ฑ
Reconsturcted
์ ์ฌ์ฉํ ์ง, ์๋๋ฉด ์ฌ์ฉ์ ์ ์ ํ๋ฉดUser Defiend
์ ์ฌ์ฉํ ์ง ์ ํฉ๋๋ค. (๋ฌด์จ๋ง?)
- OVRManager ์ปดํฌ๋ํธ > Quest Features > General > Passthroguh Support์์ Required ๋๋ Supported ์ ํ
-
๋ค์์ ์ํํ ์์ ์ ์ํ๋ ํจ์ค์ค๋ฃจ ์ ํ์ ๋ฐ๋ผ ๋ค๋ฆ ๋๋ค.
๊ฐ์ ์ฝํ ์ธ ์์ ํจ์ค์ค๋ฃจ๋ฅผ ๊ทธ๋ฆฌ๋ ค๋ฉด Placement๋ฅผ
Overlay
๋ก, ์๋์ ๊ทธ๋ฆฌ๋ ค๋ฉดUnderlay
๋ก ์ค์ . (์ฆ ๋ฐฐ๊ฒฝ์ด ํจ์ค์ค๋ฃจ์ธ๊ฑด ์ธ๋๋ ์ด, VR์์ ์ฐฝ๋ฌธ์ผ๋ก ํ์ค์ด ๋ณด์ด๋๊ฑฐ ๊ฐ์ ๊ฒ์ ์ค๋ฒ๋ ์ด) ์ฌ๋ฌ ๋ ์ด์ด๊ฐ ์๋ ๊ฒฝ์ฐ Composition Depth ์ค์ ์ ์ฌ์ฉํ์ฌ ๋ ์ด์ด ๊ฐ์ ์์๋ฅผ ์ ์ํ๋ค. Composition Depth๊ฐ ์์ ๋ ์ด์ด๋ ์ฐ์ ์์๊ฐ ๋ ๋์ผ๋ฉฐ ๊ฐ์ด ๋ ํฐ ๋ ์ด์ด๋ณด๋ค ์์ ๋ํ๋๋ค.
ํจ์ค์ค๋ฃจ๋ฅผ ๋ ๋ง์ด ์คํํ๋ ค๋ฉด ๋จผ์ ๊ธฐ๋ณธ์ ์ธ Basic Passthrough Tutorial ๋๋ Basic Passthrough Tutorial with Building Blocks๋ฅผ ์ํํ์ธ์. ๊ทธ๋ฐ ๋ค์ ์ด ๋ฌธ์ ๋ด์ ํจ์ค์ค๋ฃจ ์ํ์ ํ์ธํ ์ ์์ต๋๋ค. ๊ณ ๊ธ ์ผ์ผ์ด์ค ํ๋ก์ ํธ๋ฅผ ๋ณด๋ ค๋ฉด GitHub ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ์ฐธ์กฐํ์ธ์. Unity-Discover ๋ฐ Unity-TheWorldBeyord ํ๋ก์ ํธ๋ ๋ชจ๋ Passthrough๋ฅผ ์ฌ์ฉํฉ๋๋ค.
๋น์ ์ ์ฌ์ฉ์์ ์ ํ์ ๋ฐ๋ผ VR ๋๋ ํจ์ค์ค๋ฃจ ๋ฐฐ๊ฒฝ์ ํ์ํ๋๋ก ํ๊ณ ์ถ์ ์ ์์ต๋๋ค. ์ฐ๋ฆฌ ์์คํ ์ ์ด๋ฏธ ์ง ํ๊ฒฝ์์ ์ฌ์ฉ์์๊ฒ ์ด๋ฌํ ์ ํ๊ถ์ ์ ๊ณตํ๊ณ ์์ผ๋ฉฐ, ๊ทํ์ ์ฑ์ ์ฌ์ฉ์์ ์ง ํ๊ฒฝ ์ ํธ ์ค์ ์ ํ์ฉํ ์ ์์ต๋๋ค. ๋ณด๋ค ์ผ๋ฐ์ ์ผ๋ก ๋งํ์๋ฉด, ์ฐ๋ฆฌ ์์คํ ์ ์ฌ์ฉ์ ์ ํธ๋์ ๋ฐ๋ผ ์ฑ์ด ๊ธฐ๋ณธ์ ์ผ๋ก MR ๋๋ VR์ ์ฌ์ฉํ๋๋ก ๊ถ์ฅํฉ๋๋ค. ์ด ๊ถ์ฅ ์ฌํญ์
OVRManager.IsPassthroughRecommended()
๋ฅผ ์ฌ์ฉํ์ฌ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ฌ์ฉ ์:// ์๋ฌด MonoBehavior์ ์ด ์ฝ๋๋ฅผ ์ถ๊ฐํ์ธ์. void Start() { if (OVRManager.IsPassthroughRecommended()) { passthroughLayer.enabled = true; // ์นด๋ฉ๋ผ์ ๋ฐฐ๊ฒฝ์ ํฌ๋ช ํ๊ฒ ํฉ๋๋ค OVRCameraRig ovrCameraRig = GameObject.Find("OVRCameraRig").GetComponent<OVRCameraRig>(); var centerCamera = ovrCameraRig.centerEyeAnchor.GetComponent<Camera>(); centerCamera.clearFlags = CameraClearFlags.SolidColor; centerCamera.backgroundColor = Color.clear; // VR ๋ฐฐ๊ฒฝ ์์๊ฐ ๋นํ์ฑํ๋์ด ์๋์ง ํ์ธํ์ธ์ } else { passthroughLayer.enabled = false; // VR ๋ฐฐ๊ฒฝ ์์๊ฐ ํ์ฑํ๋์ด ์๋์ง ํ์ธํ์ธ์ } }
-
OVRManager.IsPassthroughRecommended()
- ์ฌ์ฉ์๊ฐ ํจ์ค์ค๋ฃจ๋ฅผ ์ ํธํ๋์ง ํ์ธํ๋ ํจ์๋ก ๋ณด์ธ๋ค.- ๊ฐ๋ฐ ํ๊ฒฝ์์๋ ํญ์ false๋ฅผ ๋ฐํํ๋ ๊ฒ ๊ฐ๋ค.
-
passthroughLayer.enabled
- ํจ์ค์ค๋ฃจ๋ฅผ (๋น/)ํ์ฑํ ํ๋ ๊ฒ ๊ฐ์๋ฐ ์์ง ์์ธํ ๋ชจ๋ฅด๊ฒ ์.- ์๊ฐํด๋ณด๋
passthroughLayer
๋ ๊ทธ๋ฅ ์ปดํฌ๋ํธ OVRPassthroughLayer์ ์ธ์คํด์ค ๋ณ์๋ช ์ด๊ณenabled
๋ ์ ๋ํฐ์์ง ์ค๋ธ์ ํธ์์ ์์๋๊ฑธ ํ ๋ ๋ญ๊ฐ ํน๋ณํ ๊ธฐ๋ฅ์ ์๋. OVRPassthroughLayer ์ปดํฌ๋ํธ๋ฅผ ๋นํ์ฑํํ๋ค = ํจ์ค์ค๋ฃจ๋ฅผ ๋๋ค?
- ์๊ฐํด๋ณด๋
-
์ ๋ํฐ ์นด๋ฉ๋ผ์ backgroundcolor๋ฅผ clear๋ก ํ๋ฉด ๋ค์ ํจ์ค์ค๋ฃจ๊ฐ ๋ํ๋๋ ๊ฒ ๊ฐ๋ค.- ์ด๋ค ์์์์๋ VR ์์ Passthrough Window์ ๋ง๋๋๋ฐ ์ด๊ฑธ ์ ํ๋๊ฒ ๊ฐ๋ค. ์๊ฐํด๋ณด๋ ์ด๊ฒ ์กฐ๊ฑด์ด๋ฉด ๊ทธ๋ฅ ์ ๋ํฐ ์ธ๊ณ๋ฅผ ๋ชป ๋ณด์ฌ์ฃผ๋๊ฑฐ๋ ค๋?
- VR ๋ฐฐ๊ฒฝ ์์๋ ๋ฌด์์ ์๋ฏธํ๋๊ฐ? ...centerCamera.backgroundColor์ ๋ค๋ฅธ ๊ฒ์์ฒ๋ผ ๋ญ๋ผ๋ ์ค์ ๋์ด ์์ผ๋ฉด ๊ทธ๋ง์ธ ๊ฑด๊ฐ?
๐ ์ด ๋ถ๋ถ์ Color Mapping Techniques์ ๋ฐํ์ผ๋ก ํฉ๋๋ค.
OVRPassgthroughLayer ์ปดํฌ๋ํธ๋ ํจ์ค์ค๋ฃจ์ ์๊ฐ์ ์คํ์ผ์ ์ฌ์ฉ์ ์ ์ํ๊ธฐ ์ํ ์ฌ๋ฌ ์ต์ ์ ์ ๊ณตํฉ๋๋ค.
- Opacity: ํจ์ค์ค๋ฃจ ์ด๋ฏธ์ง์ ํฌ๋ช ์ฑ์ ์ค์ ํฉ๋๋ค.
- Edge Rendering: ์ฃ์ง ๋ ๋๋ง ํํฐ๋ฅผ ์ ์ฉํฉ๋๋ค.
- Color Contro: ํจ์ค์ค๋ฃจ ์ด๋ฏธ์ง์ ์์ ์ฌํ์ ์กฐ์ ํฉ๋๋ค. ์ด ๊ธฐ๋ฅ์ ์ฌ์ฉํ๋ฉด ๋ค์ ์น์ ์์ ์ค๋ช ํ๋ ๋ค์ํ ์คํ์ผ ์ง์ ์ด ๊ฐ๋ฅํฉ๋๋ค.
์ปดํฌ๋ํธ ๋ง๊ณ ์คํฌ๋ฆฝํธ๋ก๋ ๊ฐ๋ฅํ๋ค.
OVRPassthroughLayer.textureOpacity
OVRPassthroughLayer.edgeRenderingEnabled
OVRPassthroughLayer.edgeColor
์์ ์ ์ด ๊ธฐ๋ฅ์ ๊ฐ ์ ๋ ฅ ์์์ ๋ค๋ฅธ ์ถ๋ ฅ ์์์ ๋งคํํ๋ ๋ค์ํ ๊ธฐ์ ์ ์ ๊ณตํฉ๋๋ค. ๋ค์ ์ต์ ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
- None: ํจ์ค์ค๋ฃจ ์ด๋ฏธ์ง๋ฅผ ๋ณ๊ฒฝํ์ง ์๊ณ ํ์ํฉ๋๋ค.
- Color Adjustment: ์ด๋ฏธ์ง์ ๋ฐ๊ธฐ, ๋๋น ๋ฐ ์ฑ๋๋ฅผ ์กฐ์ ํฉ๋๋ค. ์ฑ๋ ์กฐ์ ์ ์ปฌ๋ฌ ํจ์ค์ค๋ฃจ๋ฅผ ์ง์ํ๋ ์ฅ์น์๋ง ์ํฅ์ ๋ฏธ์นฉ๋๋ค.
- Grayscale: ๋ฐ๊ธฐ์ ๋๋น๋ฅผ ์กฐ์ ํ๊ณ ๊ทธ๋ ์ด์ค์ผ์ผ ํต๊ณผ ์ด๋ฏธ์ง์ ํฌ์คํฐํ ํจ๊ณผ๋ฅผ ์ ์ฉํฉ๋๋ค. ์ด ์ต์ ์ ์ ํํ๋ฉด ์ปฌ๋ฌ ํจ์ค์ค๋ฃจ ์ด๋ฏธ์ง๊ฐ ๋จผ์ ํ์์กฐ๋ก ๋ณํ๋ฉ๋๋ค.
- Grayscale To Color: ๊ทธ๋ ์ด์ค์ผ์ผ ํจ์ค์ค๋ฃจ ์ด๋ฏธ์ง์ ์์์ ์ง์ ํ๊ณ , ๋ฐ๊ธฐ์ ๋๋น๋ฅผ ์กฐ์ ํ๊ณ , ํฌ์คํฐํ ํจ๊ณผ๋ฅผ ์ ์ฉํฉ๋๋ค. ์ด ์ต์ ์ ์ ํํ๋ฉด ์ปฌ๋ฌ ํจ์ค์ค๋ฃจ ์ด๋ฏธ์ง๊ฐ ๋จผ์ ํ์์กฐ๋ก ๋ณํ๋ฉ๋๋ค.
- Color LUT: ๊ฐ RGB ์ ๋ ฅ ์์์ ํจ์ค์ค๋ฃจ ์ด๋ฏธ์ง ์คํธ๋ฆผ์ ์์ RGB(A)์ ๋งคํํ๋ look-up table(LUT)์ ์ ์ฉํฉ๋๋ค.
- Blended Color LUTs: ๋ ์ปฌ๋ฌ LUT ๊ฐ์ ๋ธ๋ ๋๋ฅผ ํจ์ค์ค๋ฃจ ์ด๋ฏธ์ง ์คํธ๋ฆผ์ ์ ์ฉํฉ๋๋ค. ์ด ์ต์ ์ ์ฌ์ฉํ๋ฉด ๋ ์์ LUT ๊ฐ์ ์ํํ๊ฒ ์ ํํ ์ ์์ต๋๋ค.
๋ํ ์คํฌ๋ฆฝํธ๋ก:
OVRPassthroughLayer.SetColorMap
OVRPassthroughLayer.SetColorMapMonochromatic
OVRPassthroughLayer.SetColorMapControls
OVRPassthroughLayer.SetBrightnessContrastSaturation
OVRPassthroughLayer.SetColorLut
OVRPassthroughLayer.DisableColorMap

-
https://blog.csdn.net/qq_46044366/article/details/132430180
์ค๊ตญ ์ฌ๋์ด ์ด ํํ ๋ฆฌ์ผ์ธ๋ฐ ๋ฒ์ญ๊ธฐ ๋๋ ค์ ์ด์ด์ ๋ณด๋ฉด ๋๋ฆ ๋ณผ๋งํฉ๋๋ค.
Passthrough Window Tutorial์๋ ๊ณผ์ ์ค์ ์ด๊ฒ ๋์ค๊ณ , ๋ค๋ฅธ ์์ ์์๋ Awake()์์ ์ด๊ฑธ ์ฐ๋ ๊ฒ ๋ณด์ด์ง๋ง ๋ฌด์จ ์ฉ๋์ธ์ง ๋ชจ๋ฅด๊ฒ ๋ค.
https://blog.csdn.net/qq_46044366/article/details/132430180 ์ด ์ค๊ตญ ํํ ๋ฆฌ์ผ ๊ธ์์๋ ์ด๊ฒ ์ ๋ช ํ๊ฒ ๋ณด์ฌ์ฃผ๋ ์ฉ๋๋ผ๊ณ ํ๋ค๋๋ฐ...
EnableUnpremultipliedAlpha.cs์ ์๋ ์ฃผ์
Since the alpha values for Selective Passthrough are written to the framebuffers after the color pass, we need to ensure that the color values get multiplied by the alpha value during compositing. By default, this is not the case, as framebuffers typically contain premultiplied color values. This step is only needed when Selective Passthrough is non-binary (i.e. alpha values are neither 0 nor 1), and it doesn't work if the framebuffer contains semi-transparent pixels even without Selective Passthrough, as those will have premultiplied colors.