๋ณธ๋ฌธ์œผ๋กœ ๋ฐ”๋กœ๊ฐ€๊ธฐ
728x90

/*  ๋ณธ ๊ธ€์€ Unity 2020.3.25f1 LTS ๋ฒ„์ „์„ ๊ธฐ๋ฐ˜์œผ๋กœ ์ž‘์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.  */

 

์œ ๋‹ˆํ‹ฐ 2D ํ”„๋กœ์ ํŠธ์—์„œ ์ผ๋ฐ˜์ ์ธ ๋ฐฉ๋ฒ•์œผ๋กœ๋Š” ์กฐ๋ช… ์ฒ˜๋ฆฌ๊ฐ€ ๋˜์ง€ ์•Š๋Š”๋‹ค๋Š” ์‚ฌ์‹ค์„ ๋ฐœ๊ฒฌํ–ˆ๋‹ค. ๊ตฌ๊ธ€์— ๊ฒ€์ƒ‰ ํ•ด๋ณด๋ฉฐ ์ฐพ์•„๋ณด๋‹ˆ, 2D์—์„œ๋Š” ๋น›(Light)์ด ์กด์žฌํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ๋น›์„ ํ‰๋‚ด๋‚ด๋Š” ์—ฌ๋Ÿฌ ๊ธฐ๋ฒ•๋“ค๋กœ ํ‘œํ˜„์„ ํ•ด์™”๋‹ค๊ณ  ํ•œ๋‹ค.

 

๊ด‘์›์— ๊ฐ€๊นŒ์ด ์žˆ๋Š” ์ •์ (Vertex)์€ ๋ฐ๊ฒŒ ํ•˜๊ณ , ๋ฉ€๋ฆฌ ์žˆ๋Š” ์ •์ ์€ ์–ด๋‘ก๊ฒŒ ํ•˜๊ฑฐ๋‚˜ Material์˜ Shader ์„ค์ •์„ "Sprite/Diffuse"๋กœ ๋ฐ”๊ฟ”์ฃผ๋Š” ๋“ฑ์˜ ๊ธฐ๋ฒ•์„ ํ†ตํ•ด ๋น›์˜ ์ฒ˜๋ฆฌ๋ฅผ ํ‘œํ˜„ํ•ด์™”๋‹ค๊ณ  ํ•œ๋‹ค.

 

๊ทธ๋Ÿฐ๋ฐ, ์œ ๋‹ˆํ‹ฐ 2D์—์„œ๋„ ์ด์ œ ๋น› ์ฒ˜๋ฆฌ์— ๋Œ€ํ•œ ํŒจํ‚ค์ง€๋ฅผ ์ง€์›์„ ํ•œ๋‹ค. URP(Universal Render Pipeline)์ด๋‹ค. ์ด์ „ ๋ฒ„์ „์€ ๊ฒฝ๋Ÿ‰ ๋ Œ๋” ํŒŒ์ดํ”„๋ผ์ธ(LWRP)์ด๋ผ๊ณ  ๋ถˆ๋ ธ๋Š”๋ฐ, ์ง€๊ธˆ์€ URP๊ฐ€ LWRP์˜ ๊ธฐ๋Šฅ๊นŒ์ง€ ๋Œ€์ฒด๋ฅผ ํ•˜๋Š” ๊ฒƒ ๊ฐ™๋‹ค. Unity ๊ณต์‹ ์‚ฌ์ดํŠธ์— ๋ณด๋ฉด URP์— ๋Œ€ํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐ„๋žตํ•˜๊ฒŒ ์„ค๋ช…์ด ๋˜์–ด ์žˆ๋‹ค.

 

URP(Universal Render Pipeline)์ด๋ž€?

 

  • Unity์—์„œ ๋งŒ๋“  ์‚ฌ์ „์— ๋นŒ๋“œ(build)๋œ ์Šคํฌ๋ฆฝํ„ฐ๋ธ” ๋ Œ๋” ํŒŒ์ดํ”„๋ผ์ธ(Scriptable Render Pipeline)
  • ๋ชจ๋ฐ”์ผ, ๊ณ ๊ธ‰ ์ฝ˜์†” ๋ฐ PC๊นŒ์ง€ ๋‹ค์–‘ํ•œ ํ”Œ๋žซํผ์—์„œ ์ตœ์ ํ™”๋œ ๊ทธ๋ž˜ํ”ฝ์„ ๋น ๋ฅด๊ณ  ์‰ฝ๊ฒŒ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋Š” ์•„ํ‹ฐ์ŠคํŠธ ์นœํ™”์ ์ธ ์›Œํฌํ”Œ๋กœ ์ œ๊ณต

 

์ถœ์ฒ˜ : https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@13.1/manual/index.html

 

์œ„์™€ ๊ฐ™์€ ์„ค๋ช… ๋ง๊ณ ๋„ ๊ต‰์žฅํžˆ ๋งŽ์€ ์„ค๋ช…๋“ค์ด ๋‚˜์™€ ์žˆ๋‹ค. ๋ Œ๋” ํŒŒ์ดํ”„๋ผ์ธ ๊ฐœ๋…, ํ‘œํ˜„, ์กฐ๋ช…, ์นด๋ฉ”๋ผ, ํฌ์ŠคํŠธ ํ”„๋กœ์„ธ์‹ฑ, ์…ฐ์ด๋” ๋ฐ ๋จธํ‹ฐ๋ฆฌ์–ผ ๋“ฑ๋“ฑ... ๋‹ค ๊ณต๋ถ€ ํ•ด๋ณด๊ณ  ์‹ถ์€ ๊ทธ๋Ÿฐ ๋‚ด์šฉ๋“ค์ด์ง€๋งŒ, ์ฒœ์ฒœํžˆ ํ•˜๊ธฐ๋กœ ํ•˜๊ณ  ์šฐ์„ ์€ URP์˜ 2D ์กฐ๋ช… ์‚ฌ์šฉ๋ฒ•๋“ค์„ ์‚ดํŽด ๋ณด๊ธฐ๋กœ ํ–ˆ๋‹ค.

 

 

 

URP 2D ์กฐ๋ช… ์‚ฌ์šฉ๋ฒ•

์ž‘์—… ์ „ ์š”๊ตฌ ๋ฐ ์ฐธ๊ณ ์‚ฌํ•ญ

 

  • Unity 2021.2.0b1 ์ด์ƒ ๋ฒ„์ „
  • Universal Render Pipelie ๋ฒ„์ „ 10์ด์ƒ
  • ํ”„๋กœ์ ํŠธ์—์„œ 2D ๋ Œ๋”๋Ÿฌ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ, URP Asset์˜ 3D ๋ Œ๋”๋ง๊ณผ ๊ด€๋ จ๋œ ์ผ๋ถ€ ์˜ต์…˜์€ ์ตœ์ข… ์•ฑ ๋˜๋Š” ๊ฒŒ์ž„์— ์˜ํ–ฅ์„ ๋ฏธ์น˜๊ฑฐ๋‚˜ ๋ฏธ์น˜์ง€ ์•Š๋Š”๋‹ค. 

 

 

 

Universal RP๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•œ ์‚ฌ์ „ ์…‹ํŒ…

1. Unity ์ƒ๋‹จ ๋ฉ”๋‰ด๋ฐ” Window → Package Manager

 

 

2. Unity Registry์—์„œ "Universal RP" ์„ค์น˜

 

 

์ฒ˜์Œ Package Manager๋ฅผ ์—ด๋ฉด, Packages: In Project๋กœ ๋˜์–ด ์žˆ๋‹ค. Packages: Unity Registry๋กœ ๋ฐ”๊พผ ํ›„, Universal RP๋ฅผ ๊ฒ€์ƒ‰ํ•˜์—ฌ ์„ค์น˜ํ•˜์ž.

 

Universal RP ํŒจํ‚ค์ง€ ์„ค์น˜ ์ค‘์ธ ๋ชจ์Šต

 

3. Assets ์ฐฝ ์šฐ ํด๋ฆญ → Create → Rendering → Universal Render Pipeline → "Pipeline Asset(Forward Renderer)" ์ƒ์„ฑ

 

 

์ƒ์„ฑํ•˜๋ฉด, ๋‹ค์Œ๊ณผ ๊ฐ™์ด RenderPipelineAsset๊ณผ RenderPipelineAsset_Renderer๊ฐ€ ์ƒ์„ฑ๋œ๋‹ค.

 

 

RenderPipelineAsset_Renderer ํŒŒ์ผ์—๋Š” Universal RP ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•  ๋•Œ ๋งŒ๋“ค์–ด์ง„ ํฌ์ŠคํŠธ ํ”„๋กœ์„ธ์Šค ๋ฐ์ดํ„ฐ๊ฐ€ ์—ฐ๊ฒฐ๋˜์–ด ์žˆ๋‹ค.

 

 

์ด์ œ Universal RP์—์„œ ์ œ๊ณตํ•˜๋Š” ๋ Œ๋” ํŒŒ์ดํ”„๋ผ์ธ์œผ๋กœ ๊ทธ๋ž˜ํ”ฝ ์„ค์ •์„ ํ•ด์•ผ ํ•œ๋‹ค.

 

 

 

4. Unity ๋ฉ”๋‰ด๋ฐ” Edit → Project Settings → Graphics → Scriptable Render Pipeline Settings์— ์ƒ์„ฑํ•œ "RenderPipelineAsset" ๋„ฃ๊ธฐ

 

์ƒ์„ฑํ–ˆ๋˜ Render Pipeline Asset ๋„ฃ๊ธฐ

 

๋งˆ์šฐ์Šค ๋“œ๋ž˜๊ทธ๋ฅผ ํ•ด์„œ ๋„ฃ์–ด๋„ ๋˜๊ณ , ์˜ค๋ฅธ์ชฝ์— ์žˆ๋Š” โจ€ ์•„์ด์ฝ˜์„ ๋ˆŒ๋Ÿฌ์„œ ๋„ฃ์–ด๋„ ๋œ๋‹ค.

๋”๋ณด๊ธฐ

๋งŒ์•ฝ ํ’ˆ์งˆ ์ˆ˜์ค€๋ณ„๋กœ ์„ค์ •์ด ํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด?

 

 

Edit → Project Settings → Quality → ์›ํ•˜๋Š” ํ’ˆ์งˆ ๋ ˆ๋ฒจ ์„ ํƒ → ์ด์ „์— ์ƒ์„ฑํ•œ RenderPipeline Asset์„ Rendering์— ๋„ฃ๊ธฐ

 


ํ”„๋กœ์ ํŠธ์— ํฌํ•จ๋œ ๊ฐ ํ’ˆ์งˆ ์ˆ˜์ค€ ๋ฐ ํ”Œ๋žซํผ์— ๋Œ€ํ•ด ์œ„์—์„œ ์ง„ํ–‰ํ–ˆ๋˜ 2~3๋‹จ๊ณ„๋ฅผ ๋ฐ˜๋ณต

 

5. Assets ์ฐฝ ์šฐ ํด๋ฆญ → Create → Rendering → Universal Render Pipeline → "2D Renderer(Experimental)" ์ƒ์„ฑ

 

 

์ด์ œ 2D ๋ Œ๋”๋Ÿฌ ๋ฐ์ดํ„ฐ๋ฅผ ์ƒ์„ฑํ•ด์ค˜์•ผ ํ•œ๋‹ค. ์œ„์™€ ๊ฐ™์ด ์ƒ์„ฑํ–ˆ๋‹ค.

 

2D Renderer (Experimental)

 

 

6. Render Pipeline Asset ํด๋ฆญ ํ›„ Inspector ์ฐฝ์—์„œ General → Renderer List → ์ƒ์„ฑํ•œ 2D Renderer Data ๋„ฃ๊ธฐ

 

 

์ƒ์„ฑํ–ˆ๋˜ 2D Renderer๋ฅผ ๋„ฃ์–ด์ฃผ๊ณ , Default๋กœ ์„ค์ • ํ•ด์ฃผ๋ฉด ๋œ๋‹ค. ์ด๋กœ์จ, ์ค€๋น„๋Š” ๋ชจ๋‘ ๋๋‚ฌ๋‹ค.

 

 

 

2D Renderer๋กœ ์—…๊ทธ๋ ˆ์ด๋“œ

 

Edit → Render Pipeline → Universal Render Pipeline → 2D Renderer → ์˜ต์…˜ ์„ ํƒ

 

 

์„ ํƒ ์˜ต์…˜์ด ๋‘ ๊ฐ€์ง€๊ฐ€ ์žˆ๋‹ค. ์„ ํƒํ•ด์„œ ์‚ฌ์šฉํ•˜๋ฉด ๋  ๊ฒƒ ๊ฐ™๋‹ค.

  • Upgrade Scene to 2D Renderer (Experimental)  :  ํ˜„์žฌ ์”ฌ(Scene)์„ 2D ๋ Œ๋”๋Ÿฌ๋กœ ์—…๊ทธ๋ ˆ์ด๋“œ
  • Upgrade Project to 2D Renderer (Experimental)  :  ํ˜„์žฌ ํ”„๋กœ์ ํŠธ(Project)๋ฅผ 2D ๋ Œ๋”๋Ÿฌ๋กœ ์—…๊ทธ๋ ˆ์ด๋“œ

 

๋ณธ์ธ์€ Upgrade Scene to 2D Renderer ์˜ต์…˜์„ ์„ ํƒํ•ด์„œ ์ง„ํ–‰ํ–ˆ๋‹ค. ๊ทธ๋ ‡๊ฒŒ ๋˜๋ฉด, ์”ฌ ๋‚ด์— ๋น›(Light) ์˜ค๋ธŒ์ ํŠธ๊ฐ€ ์—†์„ ๊ฒฝ์šฐ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์˜ค๋ธŒ์ ํŠธ๊ฐ€ ๊นŒ๋งฃ๊ฒŒ ๋œ๋‹ค.

 

์”ฌ(Scene) ๋‚ด์— ๋น›์ด ์—†์„ ๊ฒฝ์šฐ

 

 

๋น›(Light) ์˜ค๋ธŒ์ ํŠธ ์ƒ์„ฑ

 

Hierarchy ์ฐฝ ์šฐ ํด๋ฆญ → Light → 2D

 

 

๋น› ์˜ค๋ธŒ์ ํŠธ ์œ ํ˜•์ด 2D์—์„œ 5๊ฐ€์ง€๊ฐ€ ์žˆ๋‹ค.

  • Freeform Light 2D (Experimental)  :  ๋น›์˜ ๋ชจ์–‘์„ ์›ํ•˜๋Š” ๋ชจ์–‘์œผ๋กœ ์ž์œ ๋กญ๊ฒŒ ๋ณ€๊ฒฝ์ด ๊ฐ€๋Šฅ
    • "Spline editor"๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ชจ์–‘ ํŽธ์ง‘ ๊ฐ€๋Šฅ
  • Sprite Light 2D (Experimental)  :  ๋น›์˜ ๋ชจ์–‘์„ ์›ํ•˜๋Š” ์ด๋ฏธ์ง€ ๋ชจ์–‘์œผ๋กœ ์„ค์ • ๊ฐ€๋Šฅ
  • Parametric Light 2D (Experimental)  :  ๋น›์˜ ๋ชจ์–‘์„ ๋งค๊ฐœ๋ณ€์ˆ˜์˜ ๊ฐœ์ˆ˜๋ฅผ ํ†ตํ•ด ์‚ผ๊ฐํ˜•, ์‚ฌ๊ฐํ˜• ๋“ฑ์˜ ๋ชจ์–‘์œผ๋กœ ์„ค์ •
  • Point Light 2D (Experimental)  :  ์›์˜ ๋‚ด๊ฐ, ์™ธ๊ฐ์„ ์กฐ์ ˆํ•˜์—ฌ ์ „๊ตฌ์ฒ˜๋Ÿผ ํ•  ์ˆ˜๋„, ์†์ „๋“ฑ์ฒ˜๋Ÿผ ๋ถ€์ฑ„๊ผด ๋ชจ์–‘์œผ๋กœ๋„ ์„ค์ • ๊ฐ€๋Šฅ
  • Global Light 2D (Experimental)  :  ์ „์—ญ์ ์œผ๋กœ ๋น„์ถฐ์ฃผ๋Š” ์กฐ๋ช…. ํƒœ์–‘์ด๋‚˜ ๋‹ฌ์„ ์ƒ๊ฐํ•˜๋ฉด ์ดํ•ดํ•˜๊ธฐ ์‰ฝ๋‹ค.
    • ๋ ˆ์ด์–ด(Layer)๋ฅผ ์ด์šฉํ•ด ํŠน์ • ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋น„์ถœ ์ˆ˜๋„ ์žˆ๋‹ค.

 

๋ณธ์ธ์€ ์  ๊ด‘์›(Point Light 2D)๋ฅผ ์ƒ์„ฑํ•ด๋ดค๋‹ค.

 

๊ฐ„๋‹จํ•˜๊ฒŒ ๋งŒ๋“  ๋…ธ๋ž€์ƒ‰ ์ „๊ตฌ

 

์‹ค์‹œ๊ฐ„์œผ๋กœ ์กฐ๋ช… ์ฒ˜๋ฆฌ์™€ ๊ทธ๋ฆผ์ž ์ฒ˜๋ฆฌ๋ฅผ ํ•ด์ฃผ๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์—ˆ๋‹ค. ์ด ํŒจํ‚ค์ง€๋ฅผ ์ด์šฉํ•˜์—ฌ, ๋ณด๋‹ค ์™„์„ฑ๋„ ๋†’์€ ๊ทธ๋ž˜ํ”ฝ์˜ 2D ๊ฒŒ์ž„์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™๋‹ค. ๋‚ด์šฉ์ด ์›๋ž˜ ๋” ๋งŽ๋˜๋ฐ, ์šฐ์„  ๊ฐ„๋žตํ•˜๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์„ ์ •๋„๋กœ๋งŒ ์ •๋ฆฌ๋ฅผ ํ•ด๋†จ๋‹ค.

 

 

 

์ฃผ์˜์‚ฌํ•ญ

2D Renderer ์—…๊ทธ๋ ˆ์ด๋“œ๋ฅผ ํ–ˆ๋Š”๋ฐ๋„ ๋น›์— ์˜ํ–ฅ์„ ๋ฐ›์ง€ ์•Š๋Š” ์˜ค๋ธŒ์ ํŠธ๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ

 

  • ํ•ด๋‹น 2D ๊ฒŒ์ž„ ์˜ค๋ธŒ์ ํŠธ์˜ Sprite Renderer์˜ Material์— Sprite-Lit-Default๋กœ ๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธ
  • Sprite-Lit-Default๋Š” ์˜ค๋ธŒ์ ํŠธ๊ฐ€ ๋น›์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ๋ฅผ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•˜๋Š” ๊ธฐ๋ณธ Material

 

Sprite-Lit-Default

 

 

 

<์ฐธ๊ณ >

https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@13.1/manual/2DLightProperties.html

728x90
๋ฐ˜์‘ํ˜•