๐ฏ "StencilDepth"๋?
์ฌ์ค StencilDepth๋ ์ธ๋ฆฌ์ผ ์์ง์ ๊ณต์์ ์ธ ๊ธฐ๋ฅ ์ด๋ฆ์ ์๋์์.
ํ์ง๋ง ๊ฐ๋ฐ์๋ค ์ฌ์ด์์ ํํ CustomDepth์ CustomStencil ๊ธฐ๋ฅ์ ํจ๊ป ์ธ ๋
๋น๊ณต์์ ์ผ๋ก ํผํฉํด์ ๋ถ๋ฅด๋ ์ฉ์ด๋ก "StencilDepth"๋ผ๋ ๋ง์ ์ฐ๋ ๊ฒฝ์ฐ๊ฐ ์์ด์.
์ฆ, StencilDepth = CustomDepth + CustomStencil ๋ฅผ ๋ฌถ์ด ๋ถ๋ฅด๋ ๋ง์
๋๋ค.
โ
์ ๋์ ๊ฐ์ด ์ฐ๋?
์ด์ ๋ ๊ฐ๋จํด์.
CustomDepth๋ "๊น์ด" ์ ๋ณด๋ฅผ ์ฃผ๊ณ , CustomStencil์ "ํํฐ๋ง" ์ ๋ณด๋ฅผ ์ฃผ๊ธฐ ๋๋ฌธ์ด์์.
์์: ๋ฒฝ ๋๋จธ ์ค๋ฃจ์ฃ ๋ณด์ด๊ธฐ
๋ฒฝ์ ๊ฐ๋ ค์ง ์ค๋ธ์ ํธ์ ๊น์ด โ CustomDepth๋ก ๊ฐ์ ธ์ด
์ค๋ฃจ์ฃ ์ฒ๋ฆฌํ ๋์๋ง โ CustomStencil ๊ฐ์ผ๋ก ๊ตฌ๋ถ
๐ง ์ ํผ๋๋๋?
์ธ๋ฆฌ์ผ์์ ๊ด๋ จ ์ค์ ํญ๋ชฉ ์ด๋ฆ์ด ์ด๋์:
Project Settings > Rendering > Custom Depth-Stencil Pass
์ฌ๊ธฐ์๋ Depth-Stencil์ด๋ผ๋ ์ฉ์ด๋ฅผ ์จ์ ํท๊ฐ๋ฆฌ๊ธฐ ์ฌ์
๋, GPU ๋ ๋๋ง์์๋ ์๋ DepthStencilBuffer๊ฐ ํ ๋ฒํผ ์์ ๋ ๋ค ๋ด๊ธฐ๋ ๊ฒฝ์ฐ๊ฐ ๋ง์์
์ด ๊ฐ๋
์ด ์ธ๋ฆฌ์ผ์์๋ ์์ฌ์ ๋งํด์ง๋ ๊ฑฐ์์.
๐ ์ ๋ฆฌ
์ฉ์ด ์๋ฏธ ์ค์ ๊ธฐ๋ฅ ์ด๋ฆ
StencilDepth (๋น๊ณต์) CustomDepth + CustomStencil โ ์์ง์ ์์
CustomDepth ์ค๋ธ์ ํธ์ ๊น์ด๊ฐ ์ ์ฅ โ
CustomStencil ์ค๋ธ์ ํธ ๊ตฌ๋ถ์ฉ ๋ง์คํน ๊ฐ ์ ์ฅ โ
๐ฌ ๊ฒฐ๋ก
StencilDepth๋ ๊ณต์ ์ฉ์ด๋ ์๋์ง๋ง,
CustomDepth์ CustomStencil์ ํจ๊ป ์จ์ ํจ๊ณผ๋ฅผ ๋ผ ๋ ํต์นญํด์ ๋ถ๋ฅด๋ ๋ง์ด์์.
ํน์ ๋๊ฐ ๋ฌธ์๋ ์ ํ๋ธ์์ StencilDepth๋ผ๊ณ ํ๋ค๋ฉด,
"์~ CustomDepth + CustomStencil ๊ฐ์ด ์ฐ๋ ๊ฑฐ ๋งํ๋๊ตฌ๋!" ํ๋ฉด ๋ฉ๋๋ค ๐
ํ์ํ๋ฉด ์ด ๋์ ํจ๊ป ์ฐ๋ ๋จธํฐ๋ฆฌ์ผ ์์ ๋ ๋ง๋ค์ด์ค๊ฒ.
ํน์ ์ด๋ค ํจ๊ณผ๋ฅผ ๋ง๋ค๋ ค๊ณ ์ด๊ฑธ ๋ณด๊ณ ์์ด? (์: ์์๋ผ์ธ, ํ์ด๋ผ์ดํธ, ๋ฒฝ ๋๋จธ ๋ณด๊ธฐ ๋ฑ)