"Far" away lines fade away

Hello everyone,

I’m trying to render a grid. I’ve created an object that automatically adds the right amount of instanced meshes to an instanced static mesh component, set the mesh to a cube/plane, and now I’m trying to create a material for the cells. This is what I have at the moment:

This is how it looks in the editor and in-game:

You can see that far-away lines fade out and are jagged. Is there a way to fix it? Or is this not the best way one should create a grid?

Thanks,
I appreciate your help

Instead of adding multiple mesh components, you could just make one large mesh and then tile the material to make the grid.

Hello jonimake,

Thank you for your help,

I implemented your suggested method (One mesh that forms a grid using UV tiling) but the result is still the same as seen below:

Maybe look at pixel depth and lerp the opacity with that , Depth Expressions | Unreal Engine Documentation

Hello, thanks for your reply

Did you mean something like this:

It seems to work although there are some jagged edges on the sides and at the end, but I’m impressed:

I don’t quite understand why it works however. From what I understand, what the updated material does is that it increases the opacity of the drawn pixel according to its distance to the camera, but shouldn’t opacity of pixels in the white region of the mask already result to 1 anyway?