How to set the edge area to solid color when set wrap?


Here is the playground: Babylon.js Playground (
I think it maybe a simple question. As the PG shows, when I set uScale = 2 and wrap = 0, the edge area appears blurry because it uses the edge color of the texture.

So, if I want to set the edge area to the solid color, like Black Color or White color, which interface I could use?

PS: Write a custom shader is a possible approach, but I don’t know how to use mipmap information in custom shader.


unfortunately no way without manual shader changes I am aware of in WebGL,

As you can see here WebGLRenderingContext: texImage2D() method - Web APIs | MDN

There is the texture wrapping mode CLAMP_TO_BORDER + GL_TEXTURE_BORDER_COLOR to set the border color in OpenGL, but unfortunately it is not supported in WebGL1/2…

So, as @sebavan said, you will have to use a manual shader.