I’ve finally managed created my terrain by creating a single mesh, adding all vertices/positions/uvs/colors and then defining one submesh region for each texture that is used. I now have unsightly seams in the resulting rendering, which occur on the border of each surface (consisting of two triangles each to form a square) that is assigned one textured rectangle via uv coordinates.
Screenshot: https://i.imgur.com/qFuum8y.png (too complicated to reproduce in a PG :()
Things I have tried so far:
- Set edgesWidth property of the groundMesh to 0 (no effect, as edges renderer is disabled?)
- Set u/vOffset of the textures (causes more visible seams, but also removed some of them on walls?)
- Changing the texture material to Standard from Background (no effect, only reintroduces irritating reflection)
- Increase anisotropicFilteringLevel of the material (hides some parts of the seams, but doesn’t fix it)
- Change the level property of the textures (only highlights the seams more and messes up the textures)
- Change wrapU/V/R property of the material (changes seams a bit but doesn’t fix it)
- Change sampling mode via updateSamplingMode (no discernible effect)
- Re-enable backfaceCulling (it’s off normally because the terrain has holes otherwise, but this doesn’t change anything either and is probably a different issue)
If zooming really close the seam doesn’t appear to be a solid color, but rather use the same texture but at different coordinates: https://i.imgur.com/5bldaz6.png
The only thing that changed anything appears to be related to the UVs. They’re given as fractions and can be 0, 0.25, 0.5, 0.75 and 1.0 respectively, but I don’t know if that’s a problem?
Google suggests that it might be texture bleeding, though I don’t see how since I only have one mesh and the adjacent tiles don’t normally look very different at their edges. The individual tiles are created separately like in the example here: Vertex Normals - Babylon.js Documentation (So each adjoining corner does indeed have two overlapping vertices)
Any ideas? This must be a common problem, but I haven’t found anything useful applicable to BJS. Thank you for your time!