Download

"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:

CellMaterial.png

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

Grid.png

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:

bc25216008b10f37d267347d2f7bcc647fa04e34.png

Maybe look at pixel depth and lerp the opacity with that , https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/ExpressionReference/Depth/index.html

Hello, thanks for your reply

Did you mean something like this:
c82642a7efac1ecdf0d92489acafff7f958b30f8.png

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

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?