Flickering in Draw Immediate

Avatar
  • updated
  • Fixed

I just upgraded from 3.0.0 to 3.1.0 and I noticed that my Draw Immediate lines were often flickering badly in the editor.

I have now switched back to 3.0.0 and all is stable again.

This is on a Surface Pro 6 with Intel graphics so it could be performance related, if I'm hitting a limit, but I never saw flicker before. 

Image 296

Reporting a bug? please specify Unity version:
2019.4.13
Reporting a bug? please specify Shapes version:
3.1.0
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Fixed

this has now been fixed in 3.1.1

Avatar
Freya Holmér creator
  • Under Review

as of 3.1.0 the draw state is automatically pushed and popped in Draw.Command, does turning this off in settings fix it? and does it happen in the included example scenes?


it could be a code structure thing on your end with that change


and does it happen both in editor and in builds or just the editor?


Avatar
hayden scott-baron

Ah, I'm afraid I was in a hurry so I had already switched back to 3.0.0 which is working as intended. I will try again soon!

Avatar
JohannesMP

I am seeing this issue both in Builds and in Editor (both scene and game view). Unity 2020.3.0f1 LTS.

Toggling 'Always push/pop in Draw.Command makes' in settings makes no difference.

However how the flickering happens varies drastically depending on if I enable or disable GPU instancing.

Avatar
JohannesMP

Here is a screen capture showing how changing Shapes Settings affects the flickering in a random test scene consisting of Draw.Line, Draw.Polyline and Draw.Sphere calls on multiple ImmediateModeShapeDrawer components:

Shapes_3-1-0_Flickering.mp4

Flickering seems to happen on all Shapes, but some more so than others.

This is Unity 2020.3.0f1, Built in Render Pipeline.

Avatar
JohannesMP

Unsure if related, but one time while messing with recompiling Shapes settings and then loading a different scene, and I saw this error:

ArgumentNullException: Value cannot be null.
Parameter name: material
UnityEngine.Rendering.CommandBuffer.DrawMesh (UnityEngine.Mesh mesh, UnityEngine.Matrix4x4 matrix, UnityEngine.Material material, System.Int32 submeshIndex, System.Int32 shaderPass, UnityEngine.MaterialPropertyBlock properties) (at <42a5878ce129403083acccf18e43363f>:0)
Shapes.ShapeDrawCall.AddToCommandBuffer (UnityEngine.Rendering.CommandBuffer cmd) (at Assets/Packages/Shapes/Scripts/Runtime/Immediate Mode/ShapeDrawState.cs:48)
Shapes.DrawCommand.AppendToBuffer (UnityEngine.Rendering.CommandBuffer cmd) (at Assets/Packages/Shapes/Scripts/Runtime/Immediate Mode/DrawCommand.cs:153)
Shapes.DrawCommand.AddToCamera () (at Assets/Packages/Shapes/Scripts/Runtime/Immediate Mode/DrawCommand.cs:202)
Shapes.DrawCommand.RegisterCommand (Shapes.DrawCommand cmd) (at Assets/Packages/Shapes/Scripts/Runtime/Immediate Mode/DrawCommand.cs:78)
Shapes.DrawCommand.Dispose () (at Assets/Packages/Shapes/Scripts/Runtime/Immediate Mode/DrawCommand.cs:180)
DrawGizmoGrid.DrawShapes (UnityEngine.Camera cam) (at Assets/DrawGizmoGrid.cs:176)
Shapes.ImmediateModeShapeDrawer.OnCameraPreRender (UnityEngine.Camera cam) (at Assets/Packages/Shapes/Scripts/Runtime/Immediate Mode/ImmediateModeShapeDrawer.cs:36)
UnityEngine.Camera.FireOnPreRender (UnityEngine.Camera cam) (at <42a5878ce129403083acccf18e43363f>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

These were the settings I had modified (collapsed sections were not modified) 

Avatar
Freya Holmér creator

has anyone managed to make a minimal test case of this yet? none of my test scenes have this issue as far as I was able to tell

Avatar
Freya Holmér creator
  • Answer
  • Fixed

this has now been fixed in 3.1.1