Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/jsm/postprocessing/LUTPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,4 @@ class LUTPass extends ShaderPass {

}

export { LUTPass };
export { LUTPass, LUTShader };
26 changes: 12 additions & 14 deletions examples/webgl_postprocessing.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
{
"imports": {
"three": "../build/three.module.js",
"three/addons/": "./jsm/"
"three/addons/": "./jsm/",
"postprocessing": "https://esm.sh/postprocessing"
Comment on lines +19 to +20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bundles its own copy of three.js. Maybe use another CDN which isn't so helpful like unpkg.com?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With unpkg, I did not manage to get it work somehow. It searches the three dependency unfortunately. I'm no expert in importmap, if you have a quick fix, I would be glad to change it

20230613_200718.jpg

20230613_200722.jpg

Thank you in advance !

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you may have to point unpkg to the ESM file explicitly, otherwise it's serving CJS. For example:

"postprocessing": "https://unpkg.com/postprocessing@6.33.0/build/index.js"

}
}
</script>
Expand All @@ -25,13 +26,11 @@

import * as THREE from 'three';

import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';
import * as PP from 'postprocessing';


import { RGBShiftShader } from 'three/addons/shaders/RGBShiftShader.js';
import { DotScreenShader } from 'three/addons/shaders/DotScreenShader.js';
import { GammaCorrectionShader } from 'three/addons/shaders/GammaCorrectionShader.js';

let camera, renderer, composer;
let object;
Expand Down Expand Up @@ -79,20 +78,19 @@

// postprocessing

composer = new EffectComposer( renderer );
composer.addPass( new RenderPass( scene, camera ) );
composer = new PP.EffectComposer( renderer );
composer.addPass( new PP.RenderPass( scene, camera ) );

const effect1 = new ShaderPass( DotScreenShader );
effect1.uniforms[ 'scale' ].value = 4;
const dotScreenMaterialShader = new THREE.ShaderMaterial( DotScreenShader );
const effect1 = new PP.ShaderPass( dotScreenMaterialShader, 'tDiffuse' );
dotScreenMaterialShader.uniforms[ 'scale' ].value = 4;
composer.addPass( effect1 );

const effect2 = new ShaderPass( RGBShiftShader );
effect2.uniforms[ 'amount' ].value = 0.0015;
const rgbShiftMaterialShader = new THREE.ShaderMaterial( RGBShiftShader );
const effect2 = new PP.ShaderPass( rgbShiftMaterialShader, 'tDiffuse' );
rgbShiftMaterialShader.uniforms[ 'amount' ].value = 0.0015;
composer.addPass( effect2 );

const effect3 = new ShaderPass( GammaCorrectionShader );
composer.addPass( effect3 );

//

window.addEventListener( 'resize', onWindowResize );
Expand Down
Loading