Customizing GridMaterial

Is there an easy way to expand upon the GridMaterial? I want to alter the shader code to add a feature but it seems like the shaders are full of custom includes.

The easy way is to start with the GridMaterial recreated in the NME and modify it:

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

2 Likes

@Evgeni_Popov this is insane !!! could you add this in the nme doc ?

1 Like

It’s already in :slight_smile:

I did it for this thread: General help in achieving material grid effect (and @Deltakosh asked me to add it to the doc here: Node Materials Examples)

mouahahahah how could I miss this one :slight_smile:

Oh wow this is perfect! I can’t believe I missed this in the materials thread. Thanks!!!

Are there any reference documents for how the Grid Material was constructed? I’m trying to understand how the contribution per axis and normal impact sections of the shader work. I know it’s using derivative functions to help alias the lines.

Not that I know of, looking into the shader code comments is probably the easiest way: Babylon.js/grid.fragment.fx at master · BabylonJS/Babylon.js · GitHub