Grease pencil + offscreen drawing error: draw is only correct after stroke is confirmed #46579
Labels
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#46579
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Blender Version
Broken: master (after 2.66,
23848a70
), orGPencil_Editing_Stage3
branch.Worked: never
Short description of error
If I'm using offscreen viewport drawing, the current drawing lines are drawn in the wrong place (in the offscreen view3d) until the stroke is confirmed.
Exact steps for others to reproduce the error
Run this operator: www.blender.org/api/blender_python_api_2_76_1/gpu.offscreen.html
(you should then see a small viewport on top of the view3d).
Start drawing in the main scene (in my case I'm trying to draw to a surface, but all the modes should be wrong)
You should be able to see the error right away, the drawings don't match between the original viewport and the one drawn.
Changed status to: 'Open'
Added subscriber: @dfelinto
I thought that the bug was present only in the offscreen buffer, but in fact, it happens to the main viewport as well.
I have a simple fix for the main viewport (P275) but the problem is still there for the offscreen buffer
Added subscriber: @ideasman42
I found a way to reproduce the issue without offscreen drawing after Load Factory Settings:
If this is fixed, I'm confident the offscreen buffer would get fixed as well.
Added subscriber: @Sergey
@JoshuaLeung, mind having a look here?
I committed a related fix
3f85eed
but the original issue is still there (same for the dupli-window way of reproducing this bug)@JoshuaLeung any news?
Ahh... I think I finally starting to understand what's going on here!
What's happening with Grease Pencil:
Strokes are only converted to 3D coordinates after the user has finished drawing. This was done to keep the drawing tool nice and interactive, as it's not getting bogged down in all the conversion math after each and every point drawn. A really big goal for me when initially building Grease Pencil was to make sure that it was as lag-free as I could get it, as the lagginess seen in many other drawing apps at the time was something that really bugged me (and still does).
These "temporary" stroke points are held in a separate buffer (from the stroke data stored in layer->frame). They are not drawn as part of the data-space strokes, but rather they are drawn after the screenspace ones (see next point)
There are basically 3 drawing passes:
Now, here's where things start getting quite murky, as there seem to be multiple things happening at once!
Case 1) Main viewport != Camera View.
The offscreen buffer is being rendered from the perspective of the scene camera (or actually slightly back from the camera - from the actual location of the camera). However, the temporary screenspace strokes also get drawn here, so they will end up in the wrong places
Case 2) Main viewport = Camera View (but zoomed out)
When the viewport and buffer show the same view (i.e. the view from the camera), but they are not the same aspect ratio/zoom level, so some weirdness still seems to happen. I guess this is the main source of trouble I'm guessing.
I'm not sure of the specifics here yet though. Maybe it's a real problem, maybe it isn't.
Part of the problem in the offscreen buffer script example is that both of these cases end up interacting and combining together, leading to the confusing mess that you see.
As for the Alt-A case above, what's probably happening is this:
Any errors you're seeing are probably the result of that.
What can we do about all this?
Well, if the Occulus users are going to be drawing using GP while wearing the headset, my intuitive response would be that we could try just showing the same 2D screenspace overlays in both eyes. The problem I guess is that the perspective may be off, and there could be some weirdness arising from having the same thing aligned like that when presented in 2 eyes.
The other option will be to move towards directly converting the stroke points as users are drawing them. A useful side effect of this is that users with a NDOF device could rotate the view while drawing the strokes, making it possible to have the strokes be fully 3d when drawing them. Hopefully though, the performance impacts of doing this aren't too bad.
Added subscriber: @MikeErwin
Added subscriber: @JoshuaLeung
Added subscriber: @antoniov
Changed status from 'Confirmed' to: 'Archived'
This is related to a very old version. Maybe it was included by error in Tracker Curfew.