Image below shows an attempt on creating a procedural 3D grid pattern, but doesn’t produce acceptable results in all circumstances. Specifically, it will work in all cases except a cube, or vice versa, depends on the pink Lerp factor to choose which mode to use.
A limit in the approach is not to use nodes that produce boolean results for actual pattern generation (I made a Stepfunctions group which has linstep, smoothstep, and smootherstep, seems to work ok), as I want smooth transitions to be used as bump maps and so on. I also don’t want to use any “texture generators”, only maths (the noise input in the start isn’t actually added).
Right of pink Lerp node is just prepping for shading, so ignore those. Basically, fact = 0 works excellent for anything (sphere and suzanne tested, cube gets solid white), and fact = 1 works excellent for cube only (sphere and suzanne gets “spotty” or “holey”).
Have anyone made a good 3d grid texture using only maths and no boolean? Image of rough setup: