Repository navigation
Expand file tree
/
Copy pathpostprocessing.js
More file actions
43 lines (33 loc) · 1.61 KB
/
Copy pathpostprocessing.js
File metadata and controls
43 lines (33 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { GlitchPass } from 'three/examples/jsm/postprocessing/GlitchPass'
import { UnrealBloomPass } from 'three/examples/jsm/postprocessing/UnrealBloomPass'
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer'
import { OutputPass } from 'three/examples/jsm/postprocessing/OutputPass'
import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass'
import { OutlineEffect } from 'three/examples/jsm/Addons.js'
import { AfterimagePass } from 'three/examples/jsm/postprocessing/AfterimagePass'
import { RenderPixelatedPass } from 'three/examples/jsm/postprocessing/RenderPixelatedPass.js'
export function postprocessing(scene, camera, renderer){
const composer = new EffectComposer(renderer)
composer.setPixelRatio(Math.min(window.devicePixelRatio, 2))
composer.setSize(window.innerWidth, window.innerHeight)
const renderPass = new RenderPass(scene, camera)
composer.addPass(renderPass)
const glitchPass = new GlitchPass()
glitchPass.goWild = true
glitchPass.enabled = false;
composer.addPass(glitchPass)
// const pixelPass = new RenderPixelatedPass(8, scene, camera)
// pixelPass.normalEdgeStrength = 1
// composer.addPass(pixelPass)
// const afterPass = new AfterimagePass()
// afterPass.uniforms.damp.value = 0.96
// composer.addPass(afterPass)
//the real effect
// const bloomPass = new UnrealBloomPass()
// bloomPass.strength = 0.1
// composer.addPass(bloomPass)
//bloomPass.enabled = false
const outputPass = new OutputPass()
composer.addPass(outputPass)
return { composer: composer, glitch: glitchPass }
}