How to import these libraries?

hi,

I have these libraries on a basic index.html

  <script src='https://threejs.org/examples/js/postprocessing/EffectComposer.js'></script>
  <script src='https://threejs.org/examples/js/postprocessing/RenderPass.js'></script>
  <script src='https://threejs.org/examples/js/postprocessing/ShaderPass.js'></script>
  <script src='https://threejs.org/examples/js/shaders/CopyShader.js'></script>
  <script src="https://threejs.org/examples/js/shaders/FXAAShader.js"></script>
  <script src="https://threejs.org/examples/js/shaders/LuminosityHighPassShader.js"></script>
  <script src="https://threejs.org/examples/js/postprocessing/UnrealBloomPass.js"></script>

When i want to use them with the import function, that doesn’t works

import {ShaderPass} from 'https://threejs.org/examples/js/postprocessing/ShaderPass.js'

What must i do ?

Hi!
Has to be jsm not js in this path https://threejs.org/examples/js/postprocessing/ShaderPass.js.
See here: three.js/webgl_postprocessing_unreal_bloom_selective.html at efbfc67edc7f65cfcc61a389ffc5fd43ea702bc6 · mrdoob/three.js · GitHub

1 Like

hi @prisoner849

yes you are true about the path but on my test it works and i don’t know why…

But this is not the most important question, when i put the correct path with import my code don’t works… And i would like to work with modules

I keep one of your codepen to inspire me and reproduce the same scheme but in a simpler way because I suck with shader :frowning:

https://codepen.io/prisoner849/embed/VwamWbm?default-tab=&theme-id=

You’re missing a closing </script> tag for the fragment shader.

1 Like

Thank you so much

looeee already told you, whilst I was fixing :smile:

2 Likes

Hi again,

I take one of your codepens @prisoner849, this: https://codepen.io/prisoner849/pen/Exbvoyw

I transform this codepen into this :

My question is how to work with the instance to reproduce the same effect as before:

Is it not possible to group a dummy from one instance to another dummy?

I tried this:

for (let i = 0; i < conf_master.count; i++) {
  master.dummy[i].add(slave.dummy[i])
} ;

But this does nothing…

Is there a way to solve this probem ?

I think, in this case, you need to have a look at this post: Displaying 500 Basic Textured Models Performantly? (InstancedMesh or another method) - #13 by prisoner849

Yes thank you it’ exactly what i need.
Just a last question, why in my codepen

When i set

renderer.setClearColor(0x01010d, 1);

it is not the same background color as in this codepen?

However, it’s the same setting ?

I think it’s better that i open a new post