[Go-Unity] 8. ์ด๋ฏธ์ง€ 2D Sprite Atlas, Batches โญ

์—…๋ฐ์ดํŠธ:

์นดํ…Œ๊ณ ๋ฆฌ:

ํƒœ๊ทธ: , ,


Draw Call, Batches, Sprite Atlas

๊ณ ๋ฐ•์‚ฌ์˜ ์œ ๋‹ˆํ‹ฐ ๊ธฐ์ดˆ๋ฅผ ๋ณต์Šตํ•˜๋ฉด์„œ ์ •๋ฆฌ.

2D Sprite

Draw Call

  1. Cpu๊ฐ€ Gpu์—๊ฒŒ ์–ด๋–ค ๊ทธ๋ฆผ์„ ๊ทธ๋ ค ๋‹ฌ๋ผ๊ณ  ์š”์ฒญํ•˜๋Š” ๊ฒƒ
  2. Draw Call ๊ฐ’์ด ๋‚ฎ์„์ˆ˜๋ก ๊ฒŒ์ž„์ด ๊ฐ€๋ณ๋‹ค.
  3. ๋ชจ๋ฐ”์ผ์˜ ๊ฒฝ์šฐ 100์„ ๋„˜๊ธฐ์ง€ ์•Š๋Š” ๊ฒƒ์„ ๊ถŒ์žฅ

Batches

  1. Batches๋Š” Mash, Material, Shader, Draw Call ๋“ฑ์˜ ์ •๋ณด๋ฅผ ์ข…ํ•ฉ์ ์œผ๋กœ ๊ณ„์‚ฐ
  2. Draw Call์„ ํฌํ•จํ•˜๋Š” ์ƒ์œ„ ๊ฐœ๋…์œผ๋กœ Stats์— ๋ Œ๋”๋ง ์ •๋ณด๋ฅผ ํ‘œํ˜„ Batches

Sprite Atlas

  1. ์—ฌ๋Ÿฌ ์žฅ์˜ sprite ์ด๋ฏธ์ง€๋ฅผ ํ•œ์žฅ์˜ ํ…์Šค์ฒ˜์— ๋ชจ์•„ ๋‘๊ณ  ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ
  2. ์‚ฌ์šฉํ•ด์•ผ ํ•˜๋Š” ์ด์œ 
    • 2D๊ฒŒ์ž„์—์„œ ๋ฐฐ๊ฒฝ, ์บ๋ฆญํ„ฐ ๋“ฑ์„ ํ‘œํ˜„ํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋˜๋Š” ์ด๋ฏธ์ง€ ์—์…‹์€ ๋งค๋ฒˆ ๋ Œ๋”๋ง ํ•  ๋•Œ๋งˆ๋‹ค ๊ฐ ์ด๋ฏธ์ง€ ์—์…‹ ๋ณ„๋กœ 1์˜ Batches๊ฐ€ ์ฆ๊ฐ€ํ•œ๋‹ค.
    • ๋ฐฐ๊ฒฝ, ์บ๋ฆญํ„ฐ์— ์„œ๋กœ ๋‹ค๋ฅธ์ด๋ฏธ์ง€๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์˜ค๋ธŒ์ ํŠธ๊ฐ€ 100๊ฐœ์ด๊ณ  ๋™์‹œ์— ๋“ฑ์žฅํ•˜๋ฉด Batches ๊ฐ’์€ 100์ด๋‹ค
    • ํ•˜์ง€๋งŒ ๋™์ผํ•œ ์ด๋ฏธ์ง€๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์˜ค๋ธŒ์ ํŠธ๊ฐ€ 100๊ฐœ ์ผ ๋•Œ๋Š” Batches ๊ฐ’์ด 1์ด๋‹ค
  3. Sprite Atlas๋ฅผ ์‚ฌ์šฉํ•ด ์„œ๋กœ ๋‹ค๋ฅธ ์ด๋ฏธ์ง€๋ฅผ ํ•˜๋‚˜์˜ ํ…์Šค์ฒ˜์— ๋ชจ์•„๋‘๊ณ  ์‚ฌ์šฉํ•œ๋‹ค.
  4. ์‚ฌ์šฉ๋ฒ•
    • project View ์—์„œ + -> sprite atlas ๋ฅผ ์ƒ์„ฑ.
    • new sprite atlas ์˜ Objects for packing์— ์ด๋ฏธ์ง€๋“ค์„ ์ถ”๊ฐ€.
      spriteatlas





Sprite Atlas๋ฅผ ์‚ฌ์šฉํ•ด ์„œ๋กœ ๋‹ค๋ฅธ ์ด๋ฏธ์ง€๋ฅผ ํ•˜๋‚˜์˜ ํ…์Šค์ฒ˜์— ๋ชจ์•„๋‘๊ณ  ์‚ฌ์šฉํ•˜์—ฌ Batches์˜ ๊ฐ’์„ ์ค„์—ฌ ์ตœ์ ํ™”์— ์ข‹์€ ๊ฒƒ ๊ฐ™๋‹ค, ํ•˜๋‚˜์˜ atlas์— ๊ด€๋ จ์„ฑ์ด ๋†’์€ ์ด๋ฏธ์ง€๋“ค๋งŒ ๋ฌถ๋Š”๊ฒŒ ์ข‹๋‹ค.


์ฐธ๊ณ  : ์œ ๋‹ˆํ‹ฐ TOP


๐Ÿ“”

๋Œ“๊ธ€๋‚จ๊ธฐ๊ธฐ