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

354
Visualizações
ThreeJS voxel test, weird gaps between textures

Edit: I've narrowed down the problem. My texture atlas is 256px by 256px with 16x16 textures. For some reason setting my UV coordinates to 1/16th is adding a 1 pixel border on all edges. I'm unsure why, but think I can figure it out.

As a way to learn ThreeJS and graphics rendering I am working on a voxel engine to somewhat simulate Minecraft. I've recently implementing mesh culling and a lot of other optimizations for rendering large scenes of voxels efficiently. Now I am in the process of adding textures to the meshes. I recently implemented a very standard basic vertex and fragment shader you can find here:

const vertexShader = `
    varying vec2 vUv;

    void main(){
        vUv = uv;
        gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
    }
`;

const fragmentShader  = `
    uniform sampler2D texture1;
    varying vec2 vUv;

    void main() {
        gl_FragColor = texture2D(texture1, vUv);
    }
`;

The problem can be seen here: World View

Close View

In my world generation function (some simple perlin noise) I assign each block an ID which then corresponds to a specific UV value in my texture atlas when that block/face is being rendered. As for meshes, I create the voxels using 6 "master" PlaneBufferGeometries (one for each direction). When it comes to rendering a block, whatever face is visible is cloned, translated, given uv attributes, and then pushed to an array that is eventually merged together to form the mesh for each chunk.

Before I implemented my vertex and fragment shader, each "master" plane was given it's own texture, just so I didn't have to use wireframe. During this time, the textures all fit together perfectly, and this gapping was not there. Does anyone have any insight that would potentially help me? The gap only exists at off angles. If I straighten my view, the gap dissapears. For some reason up close, one of the axis's doesn't have the gap, but at a distance it does. Antialiasing is on, texture wrapping is off. When I toggle either of those parameters, the problem becomes worse.

Any help is appreciated.

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