GPencil: Ghost point on selection #90742

Closed
opened 2021-08-17 21:12:45 +02:00 by Henrik D. · 16 comments
Member

System Information
Operating system: Linux-5.10.0-6-amd64-x86_64-with-glibc2.31 64 Bits
Graphics card: GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.73.01

Blender Version
Broken version: 3.0.0 Alpha, branch: master, commit date: 2021-08-17 18:20, hash: 88dc274d05
Broken version: 2.93.0 Beta, branch: master, commit date: 2021-04-21 20:15, hash: 0f66dbea90
Broken version: 2.92.0, branch: master, commit date: 2021-02-24 16:25, hash: 02948a2cab
Broken version: 2.83 and up
Worked: 2.82

Short description of error
When selecting with box select, sometimes a weird point appears and stay until you want to take a closer look, but then it vanishes again. It appears to be sometimes black, sometimes orange and sometimes gray. Here are some screenshots:
Screenshot_20210817_205821.png

Screenshot_20210817_210534.png

The orange dot is not the origin, but at that location. I have also seen it jump to other places when selecting or even when doing completely unrelated things, so it seems to be a memory issue. Blender does not report unfreed memory in the console though.

Here is also one that appeared during weight painting, so it is colored, but this time neither at the origin nor in the drawing plane:
Screenshot_20210817_220027.png

Exact steps for others to reproduce the error

  1. Add a grease pencil monkey
  2. hide 3D Cursor and Origins from overlay and enable Stroke Direction
    From here there are several ways to recreate it. Everything that triggers a rebuild in editmode works.
  3. Drag box select very often and keep an eye out for the point at the origin
  4. toggle edit mode until you see it appear
  5. duplicate all the geometry in editmode multiple times and try selecting again. (most reliable to reproduce)
    Was able to recreate this in a different file as well using the Stroke Primitive Object like in the screenshot.

Simple way to reproduce is: toggle edit mode
Blender 2021-08-18 12-05-21.mp4

**System Information** Operating system: Linux-5.10.0-6-amd64-x86_64-with-glibc2.31 64 Bits Graphics card: GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.73.01 **Blender Version** Broken version: 3.0.0 Alpha, branch: master, commit date: 2021-08-17 18:20, hash: `88dc274d05` Broken version: 2.93.0 Beta, branch: master, commit date: 2021-04-21 20:15, hash: `0f66dbea90` Broken version: 2.92.0, branch: master, commit date: 2021-02-24 16:25, hash: `02948a2cab` Broken version: 2.83 and up Worked: 2.82 **Short description of error** When selecting with box select, sometimes a weird point appears and stay until you want to take a closer look, but then it vanishes again. It appears to be sometimes black, sometimes orange and sometimes gray. Here are some screenshots: ![Screenshot_20210817_205821.png](https://archive.blender.org/developer/F10286661/Screenshot_20210817_205821.png) ![Screenshot_20210817_210534.png](https://archive.blender.org/developer/F10286662/Screenshot_20210817_210534.png) The orange dot is not the origin, but at that location. I have also seen it jump to other places when selecting or even when doing completely unrelated things, so it seems to be a memory issue. Blender does not report unfreed memory in the console though. Here is also one that appeared during weight painting, so it is colored, but this time neither at the origin nor in the drawing plane: ![Screenshot_20210817_220027.png](https://archive.blender.org/developer/F10286701/Screenshot_20210817_220027.png) **Exact steps for others to reproduce the error** 1. Add a grease pencil monkey 2. hide 3D Cursor and Origins from overlay and enable Stroke Direction From here there are several ways to recreate it. Everything that triggers a rebuild in editmode works. 1. Drag box select very often and keep an eye out for the point at the origin 2. toggle edit mode until you see it appear 3. duplicate all the geometry in editmode multiple times and try selecting again. (most reliable to reproduce) Was able to recreate this in a different file as well using the Stroke Primitive Object like in the screenshot. --- Simple way to reproduce is: toggle edit mode [Blender 2021-08-18 12-05-21.mp4](https://archive.blender.org/developer/F10287251/Blender_2021-08-18_12-05-21.mp4)
Author
Member

Added subscriber: @HDMaster84

Added subscriber: @HDMaster84
Antonio Vazquez changed title from Grease Pencil ghost point on selection to GPencil: Ghost point on selection 2021-08-17 22:50:54 +02:00

Added subscriber: @antoniov

Added subscriber: @antoniov

I cannot reproduce on my system and never noticed before this bug.

I cannot reproduce on my system and never noticed before this bug.
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

Can reproduce on master with described steps: 24c16f5457

Simple way to reproduce is: toggling edit mode
{[F10287251](https://archive.blender.org/developer/F10287251/Blender_2021-08-18_12-05-21.mp4)} (video Added in task description)

Can reproduce on master with described steps: `24c16f5457` Simple way to reproduce is: toggling edit mode `{[F10287251](https://archive.blender.org/developer/F10287251/Blender_2021-08-18_12-05-21.mp4)}` (video Added in task description)
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member

Might be caused by D8660, can't test that right now though.
I tried debugging it more using Overlay > Stroke Direction, and found that for all the cases where I got it, it was a red dot -> endpoint of a curve. I only got it about 5 times in total though, so might not be for certain.

It seems to be some uninitialized data in the VBOs passed to edit_gpencil_vert.glsl

Might be caused by [D8660](https://archive.blender.org/developer/D8660), can't test that right now though. I tried debugging it more using Overlay > Stroke Direction, and found that for all the cases where I got it, it was a red dot -> endpoint of a curve. I only got it about 5 times in total though, so might not be for certain. It seems to be some uninitialized data in the VBOs passed to `edit_gpencil_vert.glsl`
Author
Member

Added subscriber: @fclem

Added subscriber: @fclem
Author
Member

@fclem Do you have an idea what could cause this?

@fclem Do you have an idea what could cause this?
Author
Member

Figured it out. @antoniov if you try this patch you should be able to see the ghost appear:

diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.c b/source/blender/draw/intern/draw_cache_impl_gpencil.c
index 6ed4148a7fe..2c686b253b5 100644
--- a/source/blender/draw/intern/draw_cache_impl_gpencil.c
+++ b/source/blender/draw/intern/draw_cache_impl_gpencil.c
@@ -863,6 +863,7 @@ static void gpencil_edit_batches_ensure(Object *ob, GpencilBatchCache *cache, in
     BKE_gpencil_visible_stroke_advanced_iter(
         NULL, ob, NULL, gpencil_edit_stroke_iter_cb, &iter, do_onion, cfra);
 
+    iter.verts[0].vflag = 0x12;
     /* Create the batches */
     cache->edit_points_batch = GPU_batch_create(GPU_PRIM_POINTS, cache->vbo, NULL);
     GPU_batch_vertbuf_add(cache->edit_points_batch, cache->edit_vbo);

The problem was that on the first vertex which is there for technical reasons the material was not initialized to -1. So a simple fix here is:

diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.c b/source/blender/draw/intern/draw_cache_impl_gpencil.c
index 6ed4148a7fe..e78e41b917a 100644
--- a/source/blender/draw/intern/draw_cache_impl_gpencil.c
+++ b/source/blender/draw/intern/draw_cache_impl_gpencil.c
@@ -446,6 +446,8 @@ static void gpencil_batches_ensure(Object *ob, GpencilBatchCache *cache, int cfr
     for (int i = 0; i < 2; i++) {
       iter.verts[iter.vert_len + i].mat = -1;
     }
+    /* Also mark first vert as invalid. */
+    iter.verts[0].mat = -1;
 
     /* Finish the IBO. */
     cache->ibo = GPU_indexbuf_build(&iter.ibo);
Figured it out. @antoniov if you try this patch you should be able to see the ghost appear: ``` diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.c b/source/blender/draw/intern/draw_cache_impl_gpencil.c index 6ed4148a7fe..2c686b253b5 100644 --- a/source/blender/draw/intern/draw_cache_impl_gpencil.c +++ b/source/blender/draw/intern/draw_cache_impl_gpencil.c @@ -863,6 +863,7 @@ static void gpencil_edit_batches_ensure(Object *ob, GpencilBatchCache *cache, in BKE_gpencil_visible_stroke_advanced_iter( NULL, ob, NULL, gpencil_edit_stroke_iter_cb, &iter, do_onion, cfra); + iter.verts[0].vflag = 0x12; /* Create the batches */ cache->edit_points_batch = GPU_batch_create(GPU_PRIM_POINTS, cache->vbo, NULL); GPU_batch_vertbuf_add(cache->edit_points_batch, cache->edit_vbo); ``` The problem was that on the first vertex which is there for technical reasons the material was not initialized to -1. So a simple fix here is: ``` diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.c b/source/blender/draw/intern/draw_cache_impl_gpencil.c index 6ed4148a7fe..e78e41b917a 100644 --- a/source/blender/draw/intern/draw_cache_impl_gpencil.c +++ b/source/blender/draw/intern/draw_cache_impl_gpencil.c @@ -446,6 +446,8 @@ static void gpencil_batches_ensure(Object *ob, GpencilBatchCache *cache, int cfr for (int i = 0; i < 2; i++) { iter.verts[iter.vert_len + i].mat = -1; } + /* Also mark first vert as invalid. */ + iter.verts[0].mat = -1; /* Finish the IBO. */ cache->ibo = GPU_indexbuf_build(&iter.ibo); ```

@PratikPB2123 I cannot reproduce it...could you test the fix? For me the fix is logic, but I cannot test it.

@PratikPB2123 I cannot reproduce it...could you test the fix? For me the fix is logic, but I cannot test it.

@fclem do you see any problem with the proposed fix?

@fclem do you see any problem with the proposed fix?
Member

could you test the fix?

Hi @antoniov , this is something I tried on lite debug build (will try with full build) and issue does not happen even without the proposed fix.

Might be caused by D8660, can't test that right now though.

Also: Can not reproduce with 2.92 (2021-02-24) so I don't think mentioned patch is the actual cause for the issue

>could you test the fix? Hi @antoniov , this is something I tried on lite debug build (will try with full build) and issue does not happen even without the proposed fix. >Might be caused by [D8660](https://archive.blender.org/developer/D8660), can't test that right now though. Also: Can not reproduce with 2.92 (`2021-02-24`) so I don't think mentioned patch is the actual cause for the issue
Author
Member

@PratikPB2123 It's probably caused by D6293 which introduced that file. The best way to recreate the issue seems to be duplicating all strokes, since it is likely to be using to a new memory location in that case. That way I could even recreate this issue in 2.90.1 and 2.83 but not in 2.82

@PratikPB2123 It's probably caused by [D6293](https://archive.blender.org/developer/D6293) which introduced that file. The best way to recreate the issue seems to be duplicating all strokes, since it is likely to be using to a new memory location in that case. That way I could even recreate this issue in 2.90.1 and 2.83 but not in 2.82

This issue was referenced by e76f04c870

This issue was referenced by e76f04c87079de21bde0b2f6e79226eeeccb5aea

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Antonio Vazquez self-assigned this 2021-08-30 15:27:01 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#90742
No description provided.