How to create border color in tiled plane texture like jointcolor in Marble procedural texture

Hi ,
In TILE PLANE i m looking for border color for image texture ( example floor tiles grout ) like jointcolor option given in marble procedural texture.

Welcome aboard!

You can either update your texture to add borders or make a custom material to add borders:

Note that you could also use the NME to do the same thing.

1 Like

Thanks for solution

Note that my solution to blend the border with the texture is not optimal, it’s using a pow which is a relatively slow instruction.

Maybe @nasimiasl would have a better solution as he has a bag full of nice tricks :wink:


challenge accepted :))

1 Like

also you most look for this too
i dont know who make it before :slight_smile: but i will try myself too

Thanks for quick response . Can we update marble texture with any new texture.

The below link helped me to understand well. Thank u @nasimiasl

Here’s one that should have better performance:

1 Like

If thickness reduces like 0.3 or UVscal change to a large number like 10 lines are flickering on rotation

It does not flicker for me:

sorry plz use thickness 0.03

You are hitting the subpixel limit, which means you may need to enable a bit of antialiasing in your shader (that you need to write as it is custom code)

Other option: increase pixel density (But it will be more expensive to render):

1 Like

Other option: using an FXAA postprocess:

Thanks for solution

1 Like

1 Like

another control way

1 Like

can you please explain how the below code is working


                vec2 buv = abs(fract(vDiffuseUV) - vec2(0.5)) * vec2(2.);               

                float b = max(buv.x, buv.y);

                if (b >= 1.0 - borderThickness) {

                    color.rgb = mix(color.rgb, borderColor, (b - 1.0 + borderThickness) / borderThickness);



As I m new to Babylon the syntax like where vec2(0.5) etc

bs(fract(vDiffuseUV) - vec2(0.5)) * vec2(2.)

how these all work to make a line. a small brief really will help or can you post some links where I can find something?

i have gone through few links as placed below

This is not really Babylon related but more shader related: it is GLSL code.

Learnopengl is a good resource for everything related to OpenGL: LearnOpenGL - Shaders.

You also have a lot of samples on and you can use it for your own experiments.