#Undeclared identifier when trying to us vUv

5 messages · Page 1 of 1 (latest)

muted field
#
new MeshBasicMaterial({
                defines: {
                    USE_UV: "",
                },
                onBeforeCompile: (shader: Shader) => {
                    const fs = shader.fragmentShader;
                    shader.fragmentShader = fs.replace(
                        "#include <map_fragment>",
                        `
                #include <map_fragment>
                diffuseColor = vec4(0., 1., 0., step(0.1, vUv.x - 0.5));
            `
                    );



                },
            })
#

I also tried material.vertexUvs = true

#

I really am just lazy and don't want to define the varying when presumably USE_UV should do that.

muted field
#

Alright. It's a "bug" in the three implementation of how properties won't be set in constructor unless they are not undefined.

#
material.defines = {
            USE_UV: ""
        }