Adding glitch effect to different object in a scene

Hi everyone,

I’m still a newbie to threejs, so pardon me if this is a dumb question.

I was able to adding glitch effect to the entire scene. But what I want to do is to have different objects in different place of the website (I set my scene as a background for the site), and adding that effect to the objects. Would it be possible to do that?

possible but not an easy thing to do if you are

1 Like

Possible. One of solution is add to glitch shader to material of object. Need to use onBeforeCompile.
This code chaning normalMap texture repeating:

mat["terrain"].onBeforeCompile=(shader)=>{
//console.log(shader.fragmentShader);
shader.fragmentShader=shader.fragmentShader.replace("#include <normal_fragment_maps>",
`vec3 mapN=texture2D(normalMap,vUv/40.0).xyz*2.0-1.0;
mapN.xy*=normalScale;
normal=perturbNormal2Arb(-vViewPosition,normal,mapN,faceDirection);
`
)
};
1 Like