I'm drawing a grid, pretty much like one can see in the Unity editor itself or any 3D-editor, many 3D-related applications and some games. But it doesn't look pretty in my case.
I put a few random objects to make perspective more readable.
Please also see it full-size for clearer view on the artifacts at a distance.
How grid is rendered
- Whole grid is one big plane.
- There is texture representing one cell.
- The cell is multiplicated by tiling.
How there are different line thicknesses on the picture?
It's just 3 planes (each with one grid) with different settings on top of each other. I could leave only one, but 3 grids demonstrate my problem better.
Additional details:
- Mipmap is disabled (grid cells disappear very soon over distance when it's enabled).
- Trilinear filtration and maximum aniso are set (looks worse otherwise).
My guess
I think over distance lines get to be thinner than a pixel, especially under shallow angle (hence “verticals” lines look better than “horizontal”.
Conclusion
Grid rendering is obviously done many times before me, so I presume it should be pretty much wide knowledge how to draw them prettily. I tried to google it, but any query formulation I tried led only to completely unrelated stuff. I have a bit of ideas what I can try, but I believe it would be reinventing the wheel.
P.S.: I'm using Unity engine, but I believe the engine is irrelevant.
Plane simple blurring suggested by user29244 and Thebluefish really makes huge difference: Biggest lines are too blurry now, but it's irrelevant, because easy to fix. Note that I had to enable mipmaping if you're trying to reproduce it.
Answer
You can't avoid this problem, you can try super sampling to make it less jarring ... but high frequency + high contrast works very bad in quantisize space. I go around this with a very small bit of blurring on the texture, it's counter intuitive but then you have more chance than a pixel pick a blur value and make the line looks antialiased on the texture, assuming you never get close enough that the pixel ratio to texel ration sell the trick.
More: https://elementalray.wordpress.com/tag/artifact/
No comments:
Post a Comment