Landscape Material-3

Foliage

Kang Min Kim
CodeAlpha
12 min readFeb 20, 2023

--

12. Auto Foliage
13. Performance Optimization using VSM
14. Opacity Mask
15. Add trees LGT
๐Ÿ”–Reference

12. Auto Foliage

1๏ธโƒฃ Landscape Grass Type

  • ์‹ค์‹œ๊ฐ„ ๋ณด๊ธฐ ๊ฐ€๋Šฅ
  • ๋งˆ์Šคํฌ ์˜์กด์ 
  • Collision ์—†์Œ

2๏ธโƒฃ Procedural Foliage Spawner

  • ๋ณผ๋ฅจ ์ง€์ • ๊ฐ€๋Šฅ ํ•˜๋ฏ€๋กœ ๋ณด๋‹ค ์ฃผ๊ด€์  ๊ด€์ ์œผ๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅ
  • ์‹ค์‹œ๊ฐ„ ๋ณด๊ธฐ ๋ถˆ๊ฐ€๋Šฅ ํ•˜๋ฉฐ ๋ฐ”๋€ ๊ฒฐ๊ณผ ๊ฐ’์„ ์œ„ํ•ด ์‹œ๋ฎฌ๋ ˆ์ด์…˜ ํ•„์š”
  • Collison ์ƒ์„ฑ ๊ฐ€๋Šฅ

์—ฌ์„œ๋Š” Landscape Grass Type ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„๋ณธ๋‹ค.

[I-151] Open World Demo Collection
[I152] Megascans Trees: European Black Alder

์œ„ ๋‘๊ฐœ์˜ ์–ด์…‹์„ ํ˜„์žฌ ํ”„๋กœ์ ํŠธ์— ์ถ”๊ฐ€ํ•œ๋‹ค. ๊ฐ๊ฐ 6.3G, 8G ์˜ ํฌ๊ธฐ์ด๋‹ค.

[I-153] Landscape Grass Type ์ œ์ž‘
[I-154] LGT_Grass Attribute set up
[I-155] Foliage ํŽ˜์ธํŒ…์„ ์œ„ํ•œ ์žฌ์งˆ ์…‹์—…

M_AutoLandscape ์—์„œ LandscapeGrassOutput ๊ณผ LandscapeLayerSample ๊บผ๋‚ธ๋‹ค. output์€ LGT ์˜ ์ถœ๋ ฅ์„ ์œ„ํ•œ ๋…ธ๋“œ์ด๊ณ  Sample ์€ Landscape Layer Blend ์—์„œ Layer Name ์„ ์„ ํƒ ํ•ด ๋งˆ์Šคํ‚น ์—ญํ• ์„ ํ•ด์ฃผ๋Š” ๋…ธ๋“œ ์ด๋‹ค.

[I-156] Landscape Output, Sample ์†์„ฑ ์…‹์—…
[I-157] ๋ ˆ๋ฒจ์—์„œ SoilMaterial ์„ ํƒ
[I-158] LGT ํ™•์ธ

๋งˆ์Šคํ‚น์œผ๋กœ ์ง€์ •ํ•œ SoilMaterial ๋ฅผ ์„ ํƒํ•˜๊ณ  ํŽ˜์ธํŒ… ํ•ด๋ณด๋ฉด SoilMaterial ๋ ˆ์ด์–ด์— LGT๊ฐ€ ์ถ”๊ฐ€ ๋˜์–ด ๊ทธ๋ ค์ง„๋‹ค.

[I-159] To remove the foliage, click Clear Layer

ํŽ˜์ธํŒ…ํ•œ Foliage ๋ฅผ ์ง€์šฐ๋ ค๋ฉด LGT๋ฅผ ์ ์šฉํ•œ ํ•ด๋‹น ๋ ˆ์ด์–ด ์—์„œ RB>Clear Layer ๋ฅผ ์„ ํƒํ•œ๋‹ค.

[I-160] Use HeightBlend mask for Foligae
[I-161] Adjust Foliage Parameters
[I-162] Foliage LGT ํ™•์ธ

Height ๋งต์„ ์‚ฌ์šฉํ•ด LGT๋ฅผ ํŽ˜์ธํŒ… ์—†์ด ๋ ˆ์ด์–ด ์ „์ œ์— ์ ์šฉํ•˜์˜€๋‹ค. ํ•˜์ง€๋งŒ Slope ๋ ˆ์ด์–ด์— ํ’€์ด ํ‘œํ˜„๋˜๊ณ  ์žˆ์–ด ์ด๋ฅผ ๋งˆ์Šคํ‚น์œผ๋กœ ์ œ๊ฑฐ ํ•ด์•ผํ•œ๋‹ค.

[I-163] MF_SlopeBlend>Add SlopeMaskUsed Output
[I-164] Cached SlopeMaskUsed from TransitionBlend
[I-165] Cached SlopeMaskUsed from SlopeBlend
[I-166] Create Foliage Node

Slope ๊ด€๋ จ ๋งˆ์Šคํฌ๋ฅผ ๋ชจ๋‘ Cached ํ•˜๊ณ  ๋”ํ•œ ๋’ค HeightBlend ์—์„œ ๋นผ์ฃผ์—ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด ๋†’์ด ๋งต์—์„œ Slope ๋งŒ ์ œ๊ฑฐ๋œ ๋งˆ์Šคํฌ๊ฐ€ ์ƒˆ๋กญ๊ฒŒ ์–ป์–ด์กŒ๊ณ  ์—ฌ๊ธฐ์— Switch Param ์„ ๋‹ฌ์•„์„œ ๋งˆ๋ฌด๋ฆฌ ํ•œ๋‹ค.

[I-167] Use AutoGrass
[I-168] See LGT removed from SlopLayer

13. Performance Optimization using VSM

[I-169] VSM ํ™œ์„ฑํ™”

r.Shadow.Virtual.Enable ๋ช…๋ น์„ ์ฝ˜์†”์— ์ž…๋ ฅํ•ด์„œ ํ™œ์„ฑํ™” ํ•˜๊ฑฐ๋‚˜Edit>Project Settings>Engine>Rendering>Shadows>Shadow Map Method ์—์„œ Virtual Shaodw Maps(VSM)์„ ์„ ํƒํ•˜๋ฉด ๊นŠ์ด ๋ฒ„ํผ ๋ถ„์„์„ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•˜๋Š” ๋ฉ”์†Œ๋“œ๋กœ ์”ฌ์„ ๋ถ„์„ํ•ด ํ™”๋ฉด์—์„œ ํ•„์š”ํ•œ ์˜์—ญ๋งŒํผ ๊ทธ๋ฆผ์ž๋ฅผ ํ• ๋‹น ๋ฐ ๋ Œ๋”๋ง ํ•˜๊ฒŒ ๋œ๋‹ค.

[I-170] Shadow Maps
[I-171] Virtual Shadow Maps

์ด ๊ทธ๋ฆผ์ž ์ƒ์„ฑ ๋ฐฉ๋ฒ•์€ ๋‚˜๋‚˜์ดํŠธ๋ฅผ ์œ„ํ•ด ์ถ”๊ฐ€๋˜์—ˆ๋‹ค๊ณ  ํ•ด๋„ ๋ฌด๋ฐฉํ•  ์ •๋„๋กœ ๊ณ ํ•ด์ƒ๋„ ์žฅ๋ฉด์— ์ ํ•ฉํ•˜๋ฉฐ ๋ฃจ๋ฉ˜, GI, World Partition ๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ 5.0 ๊ธฐ์ค€ 16k * 16k ์˜ ํ•ด์ƒ๋„๋กœ ์ดˆ๊ณ ํ•ด์ƒ๋„ ๊ทธ๋ฆผ์ž ๋งต์„ ์ง€์›ํ•œ๋‹ค.

ํ˜„์žฌ ์šฐ๋ฆฌ์˜ ์”ฌ์€ ๋‚˜๋‚˜์ดํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š์•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ชจ๋“  ์˜ค๋ธŒ์ ํŠธ์— r.Shadow.Virtual.NonNanite.IncludeInCoarsePages 0 ๋ฅผ ์ฝ˜์†”์—์„œ ์‚ฌ์šฉํ•˜์—ฌ ๋น„๋‚˜๋‚˜์ดํŠธ ์˜ค๋ธŒ์ ํŠธ์˜ ๋ Œ๋”๋ง์„ ๋น„ํ™œ์„ฑํ™” ํ•˜๋ฉด ์•ฝ๊ฐ„์˜ ์„ฑ๋Šฅ ํ–ฅ์ƒ์„ ์‹œ๋„ํ•ด ๋ณด๋„๋ก ํ•œ๋‹ค.

[I-172] FPS ๋น„๊ต

Foliage ๋ฅผ ๋‹ค์ˆ˜ ์‚ฌ์šฉํ•œ ํ˜„์žฌ์˜ ์”ฌ์—์„  ๊ทน์ ์ธ ๋ณ€ํ™”๋ฅผ ์ฒด๊ฐ ํ•  ์ˆ˜ ์—†์ง€๋งŒ ์ข€ ๋” ๋ณต์žกํ•œ ๋งค์‰ฌ๊ฐ€ ์‚ฌ์šฉ๋œ ์”ฌ์ผ ๊ฒฝ์šฐ ๋น„์•ฝ์ ์ธ FPS ํ–ฅ์ƒ์„ ์ฒด๊ฐํ•  ์ˆ˜ ์žˆ๋‹ค.

๊ฑฐ๋ฆฌ์— ์ƒ๊ด€ ์—†์ด ํ•ญ์ƒ VSM ์„ ์ƒ์„ฑํ•˜๋Š” ๋‚˜๋‚˜์ดํŠธ ์˜ค๋ธŒ์ ํŠธ์ฒ˜๋Ÿผ ๋น„๋‚˜๋‚˜์ดํŠธ ์˜ค๋ธŒ์ ํŠธ๋„ ๋‚˜๋‚˜์ดํŠธ์™€ ๊ฐ™์€ ๋ฐฉ์‹์œผ๋กœ ๊ทธ๋ฆผ์ž๋ฅผ ์ƒ์„œํ•˜๊ฒŒ ํ•˜๋ ค๋ฉด Culling ๊ฐ’์„ 0์œผ๋กœ ๋‘”๋‹ค. r.Shadow.Virtual.UseFarShadowCulling 0

์ฝ˜์†” ์ปค๋งจ๋“œ๊ฐ€ ์•„๋‹Œ LGT ์—์„œ ์„ฑ๋Šฅ ์ตœ์ ํ™”๋ฅผ ์œ„ํ•œ ๋ฐฉ๋ฒ•์€ ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

  • Dynamic Shadow On/Off
  • LOD
  • Cull Distance ์กฐ์ ˆ
  • Wind ํšจ๊ณผ ์ œ๊ฑฐ
[I-173] Cast Dynamic Shaodw On/Off
[I-174] LGT_Grass ์— ์‚ฌ์šฉ๋œ Grash Mesh ์˜ Screen Size

๋ ˆ๋ฒจ์— ์žˆ๋Š”M_FieldGrass_Insta_01_LOD2 ๊ฐ€ ํ™”๋ฉด์˜ 0.08๋งŒํผ ์ฐจ์ง€ํ•˜๋ฉด SM_FieldGrass ๋ฅผ ํƒ€๊ฒŸ LOD๋กœ ๊ต์ฒด ํ•œ๋‹ค. ์ฆ‰ Screen Size ์˜ ์ˆ˜์น˜๋ฅผ ์˜ฌ๋ฆฌ๋ฉด ๊ทธ๋งŒํผ LOD 2 ๊ฐ€ ํ™”๋ฉด์— ๋” ๋งŽ์ด ๋””์Šคํ”Œ๋ ˆ์ด ๋œ๋‹ค.

[I-175] Cull Distance

ํ™”๋ฉด์— ๋ณด์ด๋Š” Grass ๋ฅผ ๊ฒฐ์ •ํ•˜๋Š” ์†์„ฑ์ด๋‹ค. Camera Near/Far Clip ๊ฐœ๋…์œผ๋กœ ์ƒ๊ฐํ•˜๋ฉด ์‰ฝ๊ฒŒ ์ดํ•ด๋œ๋‹ค.

[I-176] Start Cull Distance 6000, End Cull Distance 6500
[I-177] Start Cull Distance 9000, End Cull Distance 9500
[I-178] Start Cull Distance 9000, End Cull Distance 9500

Wind ํšจ๊ณผ๋ฅผ ์ œ๊ฑฐํ•  ๊ฒฝ์šฐ Grass ๊ฐ€ ๋ฐ”๋žŒ์— ํ”๋“ค๋ฆฌ์ง€ ์•Š๊ฒŒ ๋˜๋ฏ€๋กœ ์ •์ ์ธ ์žฅ๋ฉด์—์„œ ์‚ฌ์šฉํ•˜๋„๋ก ํ•œ๋‹ค.

14. Opacity Mask

Cull Distance ์˜ ์ˆ˜์น˜๋ฅผ ์กฐ์ ˆํ•˜๋ฉฐ ์‚ฌ์šฉํ•˜๋‹ค ๋ณด๋ฉด Grass ๊ฐ€ ๊ฐ‘์ž๊ธฐ ์ƒ์„ฑ ๋˜๋Š”๋“ฏํ•œ ์•„ํ‹ฐํŒฉํŠธ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋Š”๋ฐ ์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด PerInstanceFadeAmount ๋…ธ๋“œ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

[I-179] MF_FoliageFade ์ƒ์„ฑ
[I-180] MF_FoliageFade
[I-181] Use MF_FoliageFade for Opacity Mask of M_FieldGrass

LGT_Grass ์—์„œ ์‚ฌ์šฉ๋œ Grass Mesh ์˜ Master Material ์— MF_FOliageFade ๋ฅผ Opacity Mask ์— ์—ฐ๊ฒฐ ํ•ด์ค€๋‹ค.

[I-182] Use Dithered LOD Transition

M_FieldGrass_01์˜ Material>Advanced>Dithered LOD Transition ์„ ์ฒดํฌ ํ•˜์—ฌ LOD ๋ ˆ๋ฒจ์— ๋”ฐ๋ฅธ ์ „ํ™˜๋„ ๋ถ€๋“œ๋Ÿฝ๊ฒŒ ๊ฐ€์ ธ๊ฐ€๋„๋ก ํ•œ๋‹ค.

[I-183] PerInstanceFadeAmount + DitherTemporalAA ์‚ฌ์šฉ ์ „
[I-184] PerInstanceFadeAmount + DitherTemporalAA ์‚ฌ์šฉ ํ›„
[I-185] Add Element

์žฅ๋ฉด์˜ ๋‹ค์–‘ํ•จ์„ ์ถ”๊ฐ€ํ•˜๊ธฐ ์œ„ํ•ด Add Element ํ›„ ๊ธฐ์กด์˜ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ๊ทธ๋Œ€๋กœ ๊ฐ€์ ธ ๊ฐ€๊ณ  ์‹ถ๋‹ค๋ฉด RB>Copy>Paste ํ•˜๋ฉด ๋œ๋‹ค.

15. Add trees LGT

[I-186] Add Trees LGT
[I-187] Set Grass Mesh

Grass Mesh ๋ฅผ ์ง€์ •ํ•  ๋•Œ SM์˜ LOD ๋‹จ๊ณ„์— ๋”ฐ๋ฅธ Triangles ๊ฐœ์ˆ˜๋ฅผ ๋ณด๊ณ  ๋ ˆ๋ฒจ์˜ ํผํฌ๋จผ์Šค๋ฅผ ๋–จ์–ด๋œจ๋ฆฌ์ง€ ์•Š๋Š” ๊ฒƒ์„ ์„ ํƒํ•˜๋Š” ๊ฒƒ์ด ์ค‘์š”ํ•˜๋‹ค. SM์—์„œ Enable Nanite Support ๋ฅผ ํ™œ์„ฑํ™” ํ•œ๋‹ค๊ณ  ํ•ด๋„ ๊ธฐ๋ณธ์ ์œผ๋กœ ์ ์€ ๋ฐ์ดํ„ฐ๋กœ ์ตœ๋Œ€ํ•œ์˜ ์‹œ๊ฐ์  ํšจ๊ณผ๋ฅผ ๋‚ผ ์ˆ˜ ์žˆ๋Š” ์–ด์…‹์„ ์„ ํƒํ•˜๋Š” ๊ฒƒ์€ ์ค‘์š”ํ•˜๋‹ค.

[I-188] Add Switch Param for Trees
[I-189] Add new element and set to LGT_Trees
[I-190] A view of the Leve with trees
[I-191] Add LandscapeLayerSample to M_AutoLandScape Material
[I-192] Add Subtract

LandscapeLayerSample ์„ ์ถ”๊ฐ€ํ•˜๊ณ  ์ด๋ฆ„์„ SoilMaterial ๋กœ ์ง€์ •ํ•œ๋‹ค Landscape Layer Blend ์— ์ƒ์„ฑํ•œ SoilMaterial ์„ Subtract ๋ฅผ ์‚ฌ์šฉํ•ด ๋นผ์ฃผ๋Š” ๋ฐฉ์‹์œผ๋กœ paint ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด grass ์œ„์— ๊ธธ์„ ํ‘œํ˜„ํ•˜๋Š” ํšจ๊ณผ๋ฅผ ๋‚ผ ์ˆ˜ ์žˆ๋‹ค.

[I-193] None issue

Landscape>paint ์—์„œ None ์œผ๋กœ ์„ ํƒ๋˜์–ด ์žˆ๋‹ค๋ฉด ๋ธŒ๋Ÿฌ์‰ฌ๊ฐ€ ๋นจ๊ฐ„์ƒ‰์œผ๋กœ ํ‘œ์‹œ ๋  ๋•Œ๊ฐ€ ์žˆ๋Š”๋ฐ ๋‹จ์ˆœํ•œ ์—๋Ÿฌ ์ด๋ฏ€๋กœ ๋“œ๋ž ๋‹ค์šด์—์„œ SoilMaterial_LayerInfo ๋ฅผ ํด๋ฆญํ•ด์ฃผ๋ฉด ๋œ๋‹ค.

[I-194] SoilMaterial on the grass
[I-195] Align to Surface ON
[I-196] Align to Surface OFF

๋งˆ์ง€๋ง‰์œผ๋กœ Surface ๋…ธ๋ฉ€์„ ๋”ฐ๋ผ ์ •๋ ฌ๋œ LGT๋ฅผ ์ˆ˜์ง์œผ๋กœ ์„ธ์šฐ๊ณ  ์‹ถ๋‹ค๋ฉด LGT ์†์„ฑ์—์„œ Align to Surface ๋ฅผ ์ฒดํฌํ•ด์ œ ํ•˜๋ฉด ๋œ๋‹ค.

--

--