How to stop flickering when using Line Renderer and any camera follow script?
I've hit a pretty hard wall in my game development... for aesthetic purposes, I'm trying to give the game a vector-based look, which includes using the line-renderer to make thin lines. From overhead view, I have a triangular spaceship and a 0.01-width line (to be used for making walls).
When viewing things through the Main Camera it works, but as soon as I use any 'camera follow' script to follow the ship, it causes the line to start flickering, which gets amplified with post-processing fx.
I've tried many things to stop the flicker:
orthographic vs perspective camera
varying the line size (anything below ~0.5-width has noticeable flicker)
rendering the line through different methods (e.g. bitmap, shader, Vectrosity, etc..)
several different camera-follow scripts, from default Unity asset scripts to online posted code
moving all combinations of ship and follow code with FixedUpdate, LateUpdate, Update
changing clipping planes, above Near: 0.3 below Far: 1000
different rendering paths, deferred, forward, legacies
using 2 cameras with depth masks, culling and layers, main camera renders ship, the other renders line with either camera having ship-follow script attached
changing anti-aliasing 2x - 8x
I am certain the problem always begins when using a ship-follow script, but using one seems necessary. A slight observation I noticed is if the ship moves straight along the same axis as the wall, there's no flicker i.e. with a horizontal wall, flying straight left or right causes no flicker, same with vertical/up-down, any movement along the other axis causes the flickering.
I've searched for answers online, but oddly enough I don't see a post about this exact issue. Is there something more I can try?
Have you found any solution for this? I think I have similar problem - when I draw straight line (using line renderer) and when my player is moving around and (camera is following him) then line is flickering.
Answer by drhousemd · Apr 17, 2021 at 05:42 AM
@RudaSwinia No, I put the project on hold and was planning to try again soon... I'm going to look up recent posts using the related tags at the top of my post, the Related Questions suggest this might be an alternative: http://answers.unity.com/answers/1680849/view.html