Shader stop working with ThreeJS update

Good day comrades,
One good mate created a shader for older version of ThreeJS days ago:

new THREE.ShaderMaterial({
...
vertexShader: `
#define USE_MAP
varying vec2 placer;
uniform vec4 offsetRepeat;
void main() {
    placer = uv * offsetRepeat.zw + offsetRepeat.xy;
    gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,
fragmentShader: `
#define USE_MAP
uniform sampler2D map;
varying vec2 placer;
void main() {
    #ifdef GAMMA_INPUT
        fragColor.xyz *= fragColor.xyz;
    #endif
    gl_FragColor = vec4(1.0);
    vec4 fragColor = texture2D( map, placer );
    gl_FragColor = gl_FragColor * fragColor;
}`
});

Some time ago I’ve tried to update the ThreeJS core to resent version and got a thing, that object is not getting texture - it’s just black thing.
Can anyone help me this this? I am not in the shaders at all and, sadly, I don’t have the contact with that mate anymore.

!Update:
If to remove the fragColor from line
gl_FragColor = gl_FragColor * fragColor;
then the model texture is white. So my guess is that fragColor has wrong parameters.
So it seems that something has been changed in texture2D( map, placer ) since old versions. Any ideas?

Trying to make a fiddle, no results so far… Sorry…

Thank you in advance.

You’ll need to provide more information for us to help. Which versions of three.js are you moving to and from? Can you provide a jsfiddle showing the shader?

Thank you for your time.
Moving from 72 (or 76… something over there… sorry) to 115. But the idea is to stay up to date with imports.
Not sure about jsfiddle, but I will try to do something…
But there wont be any errors, if this is what you were thinking about.

r72 to r115 is a pretty huge change. Without being able to see or reproduce your problem I think anyone will have a hard time providing help so I think a fiddle is necessary either way.

2 Likes

You are right and there are no debts about it, but it is pretty hard to reproduce the issue without original object and textures, as I am restricted to share them… trying to find some random objects…

Please, see update in the description. Hope that will give some ideas.

Thank you!