Hi guys

First of all i wasnt sure about proper section nor the title.

Anyway here is my problem.

I was looking for some way to render a grid.

I’ve found this post which generally gives me what i want.

However i fail to understand why it works.

Here is the shader from the link above:

Trying to follow what it does i’ve simplified it to such version:

And here is the result im getting:

The ball is just for reference and is at world position 5500,0,0.

The shader is applied to a plane.

I would expect that above shader generates BLACK field under the ball because cos(5500/100) ~ 0.02.

Still it seems to have generated 1 perfectly there.

How come??

Im not interested in blindly copying someone elses code and i want to understand the code im using but this behavior makes totally puzzled.

Can anyone explain how come that my above shader generates a line perfectly at each “cellsize” step even tho that world position is fed directly to cosine function so rendered line step should be different?

What do i miss?

Any help is greatly appreciated.

Thanks