Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

136
Visualizações
Problems with ShaderMaterial

To start off, I am new to the ShaderMaterial and GLSL. I did read up on the GLSL Manual and looked at some examples found in my Google searches, and I'm trying my hand at this to create some texture effects in my projects. Right now I am just trying to put a texture on a surface as if I was just using MeshBasicMaterial. The code pieces look like this:

<script type="x-shader/x-vertex" id="vertexskyshader">
    varying vec2 vUv;
    void main()
    {
        vUv = uv;
        gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
    }
</script>

<script type="x-shader/x-fragment" id="fragskyshader">
    varying vec2 vUv;
    uniform sampler2D material;
    void main()
    {
        gl_FragColor = texture2D(material, vUv);
    }
</script>

<script type="module">
    import * as THREE.........

    for(f = 0; f < lvlfaces.length; f++)
    {
        var facemat = new THREE.ShaderMaterial({ vertexColors: THREE.VertexColors, transparent: lvlfaces[f].adjmode, depthWrite: !lvlfaces[f].adjmode, depthTest: !lvlfaces[f].adjmode,
            uniforms: { texture: { value: matTable[lvlfaces[f].mat] } },
            vertexShader: document.getElementById("vertexskyshader").textContent,
            fragmentShader: document.getElementById("fragskyshader").textContent });

The lvlfaces are being loaded from a file and are an array of objects containing information about the surface (like texture file name .mat, vertices used, uv coords, etc). matTable array where the elements are named after the texture file names contain the actual texture data (loaded from THREE.TextureLoader()). The problem I am having is that when I move around the object the textures shown change to a different texture in the matTable. Not only that but another object that uses this same loop but is assigned different textures shows the exact same textures and changes as the object I'm moving around.

animation too large for import

I have a feeling there is a conflict somewhere here but I have no idea what the fix would be.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda