Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

137
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda