A PBR version of babylon.gridMaterial?

I have been using a grid material for the floor in many of my tool scenes. I set the interval to 1, which is good for XR, in that it corresponds to 1 meter.

const floorMat = new BABYLON.GridMaterial('floorMat', scene);
floorMat.majorUnitFrequency = 1;
floorMat.mainColor = new BABYLON.Color3(.45, .45, .45);
floorMat.lineColor = new BABYLON.Color3(.9, .9, .9);

It would be nice if it were also PBR material as well, or at least the pieces I use. I could probably get close with thin instances of squares just above a large square of a different color, but of course it also forces the floor to be square. I was using a circular floor, so that corners are not really pronounced. That works pretty good for XR, since the camera is close to the ground.

Any prospects?

You could use the NME version of the grid material:

https://nme.babylonjs.com/#I4DJ9Z

You need simply to change the Lights block with a PBRMetallicRoughness block, something like:

https://nme.babylonjs.com/#I4DJ9Z#6

1 Like