GPv3: Drawing slow down when drawing a very long stroke #123317

Open
opened 2024-06-17 16:43:35 +02:00 by Antonio Vazquez · 7 comments

When drawing a stroke very long without release the mouse, the drawing starts to slow down. This doesn't happen with short strokes.

To reproduce:

Just open default scene and start to draw a stroke with the mouse without releasing the mouse button.

When drawing a stroke very long without release the mouse, the drawing starts to slow down. This doesn't happen with short strokes. To reproduce: Just open default scene and start to draw a stroke with the mouse without releasing the mouse button.
Antonio Vazquez added the
Type
Report
Status
Needs Triage
Severity
Normal
labels 2024-06-17 16:43:36 +02:00
Antonio Vazquez added this to the Grease Pencil project 2024-06-17 16:43:36 +02:00
Member

Some observations:

  • 75% of the time is spent triangulating the stroke
  • 19% of the time is spent calculating the curve plane normals
  • Only 1 core is being used the whole time
Some observations: - 75% of the time is spent triangulating the stroke - 19% of the time is spent calculating the curve plane normals - Only 1 core is being used the whole time
Member

Ah I guess it's not just me 😅

Ah I guess it's not just me 😅
YimingWu added
Module
Grease Pencil
Status
Confirmed
and removed
Status
Needs Triage
labels 2024-06-18 07:14:58 +02:00
Iliya Katushenock added the
Interest
Performance
label 2024-06-18 13:01:39 +02:00
Member

Ideas for improving the performance:

  • The curve plane normals don't need to be recomputed, we know the normal of the drawing plane. In case where we draw on a surface or on other strokes, we can delay the computation until the stroke is done. We should also look at ways of improving the performance of the plane normal computation itself.
  • Unfortunately, we can't get a around the triangulation of the stroke (even if there is no fill to render). This will change in the future hopefully.
  • Since we're incrementally adding new points, it would be much better to also incrementally triangulate the fill. This would mean that with every new set of points added, we would only need to refine the triangulation instead of rebuilding it from scratch. See for example https://en.wikipedia.org/wiki/Delaunay_triangulation#Incremental.
Ideas for improving the performance: * The curve plane normals don't need to be recomputed, we know the normal of the drawing plane. In case where we draw on a surface or on other strokes, we can delay the computation until the stroke is done. We should also look at ways of improving the performance of the plane normal computation itself. * Unfortunately, we can't get a around the triangulation of the stroke (even if there is no fill to render). This will change in the future hopefully. * Since we're incrementally adding new points, it would be much better to also incrementally triangulate the fill. This would mean that with every new set of points added, we would only need to refine the triangulation instead of rebuilding it from scratch. See for example https://en.wikipedia.org/wiki/Delaunay_triangulation#Incremental.
Bart van der Braak added
Type
Bug
and removed
Type
Report
labels 2024-08-14 12:58:59 +02:00

Tested this in beta again, same problem persists. If you zoom out the stoke get's wonky even faster.

Tested this in beta again, same problem persists. If you zoom out the stoke get's wonky even faster.
Member

But if we need to have triangulation anyway why wouldn't old GPv2 slow down the same way 🤔

But if we need to have triangulation anyway why wouldn't old GPv2 slow down the same way 🤔
Member

@ChengduLittleA GPv2 didn't do the triangulation because it didn't write the stroke to the frame, it wrote it to a temporary buffer that is rendered seperately (sbuffer). This added a lot of code, so in GPv3 we write to the drawing directly.

But like I mentioned above, we don't need to write to a temporary buffer if we improve the overall situation.

@ChengduLittleA GPv2 didn't do the triangulation because it didn't write the stroke to the frame, it wrote it to a temporary buffer that is rendered seperately (`sbuffer`). This added a lot of code, so in GPv3 we write to the drawing directly. But like I mentioned above, we don't need to write to a temporary buffer if we improve the overall situation.

sharing my video for reference here since my issue was a duplicate. Stroke performance drops in the first keyframe because there are more strokes than when a new keyframe with no GP Strokes

sharing my video for reference here since my issue was a duplicate. Stroke performance drops in the first keyframe because there are more strokes than when a new keyframe with no GP Strokes
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
6 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#123317
No description provided.