Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

normalizeUV() fails when a single polygon has more than 1.0 textures fit either horizontally or vertically #31

Open
meszaros-lajos-gyorgy opened this issue Oct 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@meszaros-lajos-gyorgy
Copy link
Collaborator

meszaros-lajos-gyorgy commented Oct 13, 2024

This looks okay:

// 2x100 x 2x100 tiles
const geometry = new PlaneGeometry(200, 200, 2, 2)

const material = new MeshBasicMaterial({
  map: Material.fromTexture(Texture.l2TrollStoneGround04, { flags: ArxPolygonFlags.DoubleSided }),
})
const mesh = new Mesh(geometry, material)
geometry.rotateX(MathUtils.degToRad(-90))

// every tile 2x2 texture mapped onto
scaleUV(new Vector2(4, 4), geometry)

// normalizeUV(geometry)

applyTransformations(mesh)
mesh.translateX(map.config.offset.x)
mesh.translateY(map.config.offset.y)
mesh.translateZ(map.config.offset.z)
applyTransformations(mesh)
map.polygons.addThreeJsMesh(mesh, { tryToQuadify: QUADIFY, shading: SHADING_SMOOTH })

Observe that UV goes from 0.00 to 2.00
image

Enabling the normalizeUV(geometry) line will make the UV coordinates clamp from 0.00 to 0.00:
image

@meszaros-lajos-gyorgy meszaros-lajos-gyorgy added the bug Something isn't working label Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant