nwpointer / three-landscape

React-three-fiber compatible abstractions that make it easier to render high quality landscapes scenes

Home Page:https://three-landscape.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Texture atlas support

nwpointer opened this issue · comments

Texture atlas are single files with multiple textures in them. This will be helpful if you are nearing the 16 texture per material limit or trying to reduce total number of files downloaded

Detect if there are any duplicate textures

generate a maping reference

    [surface]: {
        normal: {
            physicalTexture: map*
            offset: [x,y]
            size: [x,y]
        }
    }

for duplicates, the offset and size will be unnessisary

in the shader create a :

  • uTextures[16]
  • uTextureMap[surfaces.length]
  • uTextureOffset[surfaces.length]
  • uTextureSize[surfaces.length]

Instead of using atlases opted for the simpler TextureArrays built into webgl.

shipped with #30