Updating sampling mode adds weird lines through mesh

I’m trying to change the color of an entire mesh, to a color picked from a texture atlas. I believe I am indexing the atlas correctly, but when I do (without updating sampling mode), it is a blended color that isn’t exactly the color I want. So I update the sampling mode to nearest so that it will be exact. But then it adds weird lines through the meshes. Any ideas why?


babylonjs bug

You should use the clamp address mode for the texture and center the u/v coordinates inside the texel (by offsetting by 0.5/16):


Note that using the default sampling mode (trilinear) seems to work as long as you set the clamp address mode and center the u/v coordinates.

1 Like

Awesome! Thank you, I couldn’t find that anywhere!