Post Processing

Post Processing์ด๋ž€

ํ›„์ฒ˜๋ฆฌ ํšจ๊ณผ, ์ตœ์ข… ๋ Œ๋”๋ง ๊ฒฐ๊ณผ๋ฌผ์— ๋‹ค์–‘ํ•œ ๊ทธ๋ž˜ํ”ฝ ํšจ๊ณผ๋ฅผ ์ ์šฉํ•˜๊ณ  ์‹ถ์„ ๋•Œ ์‚ฌ์šฉ๋œ๋‹ค.

  • ์ ์šฉํ•  ๋‹ค์–‘ํ•œ ๊ทธ๋ž˜ํ”ฝ ํšจ๊ณผ๋ฅผ three.js ์—์„  pass๋ผ๊ณ  ํ•œ๋‹ค.

  • EffectComposer๋ฅผ ํ†ตํ•ด ๊ฒฐ๊ณผ๋ฌผ์— pass๋“ค์„ ์ˆœ์ฐจ์ ์œผ๋กœ ์ถ”๊ฐ€ํ•ด์„œ ์ ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer'; 

const renderer = new THREE.WebGLRenderer({
  antialias: true,
});
const composer = new EffectComposer(renderer);
// renderer๊ฐ€ ๋ Œ๋”๋ง์„ ์ง์ ‘ ์ˆ˜ํ–‰ํ•˜๋Š” ๋Œ€์‹  composer๋ฅผ ํ†ตํ•ด ์ˆ˜ํ–‰ํ•˜๋„๋ก ํ•œ๋‹ค.
composer.render(); 

Pass

  • renderPass โ†’ EffectComposer๊ฐ€ ๋‚ด๋ถ€์ ์œผ๋กœ ๋ Œ๋”๋ง๋œ ๊ฒฐ๊ณผ๋ฌผ์„ ํ›„์ฒ˜๋ฆฌ์— ๊ธฐ๋ณธ ์žฅ๋ฉด์œผ๋กœ ์„ค์ •ํ•  ๋ชฉ์ ์œผ๋กœ ์ถ”๊ฐ€ํ•˜๋Š” pass

  • UnrealBloomPass โ†’ Three.js์—์„œ ๊ธฐ๋ณธ์ ์œผ๋กœ ๋‚ด์žฅ๋˜์–ด ์žˆ๋Š” ํ›„์ฒ˜๋ฆฌ ํšจ๊ณผ์ด๋ฉฐ, ๋ ˆ์ด์ € ๊ด‘์„  ๊ฐ™์€ ํšจ๊ณผ๋ฅผ ๋‚˜ํƒ€๋‚ด๊ณ  ์‹ถ์„ ๋•Œ ์‚ฌ์šฉ

    • resolution(ํ•ด์ƒ๋„): ๋” ๋†’์€ ํ•ด์ƒ๋„๋Š” ๋” ๊ณ ํ™”์งˆ์˜ ๋ธ”๋ฃธ ํšจ๊ณผ๋ฅผ ์ œ๊ณตํ•˜์ง€๋งŒ ์„ฑ๋Šฅ์— ์˜ํ–ฅ์„ ๋ฏธ์นœ๋‹ค.

    • strength: ๋ธ”๋ฃธ ํšจ๊ณผ์˜ ๊ฐ•๋„

    • radius: ๋ธ”๋ฃธํšจ๊ณผ์˜ ๋ฐ˜๊ฒฝ

    • threshold : ์–ผ๋งˆ๋งŒํผ์˜ ๋น›์˜ ์–‘์„ ๋ฐ›์•˜์„ ๋•Œ ํšจ๊ณผ๋ฅผ ์ ์šฉํ• ์ง€๋ฅผ ๊ฒฐ์ •, ๋‚ฎ์„ ์ˆ˜๋ก ํšจ๊ณผ๊ฐ€ ํฌ๋‹ค.

import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass';
import { UnrealBloomPass } from 'three/examples/jsm/postprocessing/UnrealBloomPass'
 
const renderPass = new RenderPass(scene, camera);
composer.addPass(renderPass);

const unrealBloomPass = new UnrealBloomPass(
  new THREE.Vector2(innerWidth, innerHeight),
    1.2,
    1,
    0
  );
composer.addPass(unrealBloomPass);

Last updated