i try do add a grid mesh and material, all look ok, but i have one think a can not understand.
need some help to catch what i am doing wrong.
the grid lines changes when rotating arround the scene with the camera.
the lines are simply more visible (as they should always be) when the camera is in the back of the character.
turn arround the character and wou will see, it is right in the middle side between front and back the think’s happen.
The problem you are experiencing is tied to createDefaultEnvironment. It creates a plane with a gray color fading out away from the center.
This plane is z-fighting with your grid.
There are some possible ways to avoid this. You could move your grid higher on the Y axis or lower the BackgroundPlane generated by the helper.
This is suggested in the docs but it doesn’t work well in the playground of your scene. Fast Build a World - Babylon.js Documentation (Search for z-fighting)
Alternatively you could set the alphaIndex manually. This tells Babylon which object to render on top of the other.
// Set alpha index manually for ground objects
gridMesh.alphaIndex = 2;
scene.meshes.find(m => m.name === 'BackgroundPlane').alphaIndex = 1;
yep, before posting the question here, i have first try on my scene to move up the grid and move down the environment ground, but this not make really difference.
i have try also, to modify the opacity texture in the GridMaterial, without good result.
what was confiuse me, is the inpector tool create a same grid that work well.
anyway, to post here i just use de sample scene “Animation Blending” from the playground and add the litle code for create the grid without specify the opacity texture becose this have no impact on the result.
to conclude, your alternative with alphaIndex do the job.