Page MenuHome

Grease pencil occluded by other objects while drawing, then appears on release
Closed, DuplicatePublic

Description

System Information

Operating system:
Graphics card:

Blender Version

Broken both in 2.93 alpha and 2.92

Short description of error
The GP strokes are incorrectly occluded by presence of other meshes in the scene. I first noticed this behavior when I added an empty/image with a chalkboard image (which intended to place in XZ plane) so I can use the GP to drawn as if I was drawing on a chalkboard, but the stroke would not always appear on the board while I was drawing, but it would only appear after I released the mouse (ending the GP stroke). I tried to move the empty (image) back along Y a little bit, thinking that maybe drawing with GP in XZ plane conflicts (depth z-fights?) with the image displayed in the same XZ plane, however the GP stroke occlusion still occurs even if the image was placed behind the XZ plane.

To isolate this I then tried to see if this effect happens even with a regular mesh (not just empty/image).. so I added a simple plane object to the scene and move it along Y by some amount (not to be exactly located in the XZ plane). Then with the GP “align strokes to current view” mode set to either “Front (XY)" mode or “View" mode it appears that for some angles of the user camera the GP stroke is partially or completely occluded by something (obviously has something to do with the plane mesh, but it’s not exactly occluded by the plane footprint). For different angles of the user camera this masking area seems to be always different. I noticed this masking area to be somewhat triangular in nature within the plane mesh bounds.

In “view” mode I would expect the GP strokes to disappear as the strokes (drawn on the plane parallel to the view, passing though the origin) go behind the plane mesh (and indeed they do in “view” mode) but the strokes also partially disappear in other parts of the screen over the plane mesh even when the strokes are supposed to be in front of the plane mesh. (as you can see in the attached screen capture). Some of these partial occlusions still persist even after releasing the mouse ending the stroke.. as you move the user camera around you could see parts of the strokes in front of the plane mesh get a different shade of gray.

And here is a demo with strokes being occluded while the mode is “Front (XY)”. It appears that the algorithm used for this mode also uses the same masking (depth maps?) used for the “view” mode while drawing (when ending the stroke the GP stroke is mapped in 3D to the XZ plane and it’s shown not occluded). In this drawing mode the occlusion while drawing seems to be incorrect however (both the partial and the complete occlusions).

Exact steps for others to reproduce the error

See attached blend file.. (simple plane mesh parallel to XZ plane at a small Y location away from XZ plane). While in GP draw mode, rotate the user camera around and then draw a continuous stroke all over the plane mesh (outside or inside the plane bounds). You should see the strokes being occluded (partially or completely) in some parts of the viewport (within the bounds of the plane mesh). When releasing the mouse to end the stroke the entire GP stroke should appear. (note: in “view” mode some parts of the stroke may be going through the plane mesh so they are legitimately occluded after ending the stroke).

Event Timeline

More findings.. actually this behavior may not even be related to having meshes in the scene at all. If I add a picture (e.g. a chalkboard pattern) to the camera to be displayed (thorough the camera) as a background image, the same occlusion effect occurs.

And another example with the background image opacity set to 1.0.. where the occluded part of the stroke has a different blending and it is more pronounced.

And for what it’s worth.. here’s another example illustrating the occlusion for different camera orientations.. for each orientation the occlusion seems to be different, which indicates it may be related to not just the camera but also its orientation relative to the world.

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Needs Information from User.Mar 1 2021, 9:38 AM

Looks a bit like a mixed bag of issues:

the delayed update has been reported here [it is a known limitation due to performance reasons

I would like to use GP for live illustration purposes (since the annotation tool is too simple and doesn’t allow custom strokes etc), so having the GP only show on mouse release will not work for me. Maybe such optimization can be turned off if i don’t care about performance issues?

Having the GP only show on mouse release will not work for me.

Makes sense

Maybe such optimization can be turned off if i don’t care about performance issues?

This would be a request for modified/improved behavior and not a bug in current behavior which we dont handle in this bugtracker.
For user requests and feedback, please use other channels: https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests
For more information on why this isn't considered a bug, visit: https://wiki.blender.org/wiki/Reference/Not_a_bug

That leaves us with the blending issue, any update on this (ref, Fade Geometry)?

Since we didnt hear back about the blending issue, will merge into T85764.
(feel free to comment again though if more information can be provided)