Images drawn with the Python gpu module no longer draw on top in the Image Editor #81002

Closed
opened 2020-09-20 19:16:48 +02:00 by Inês Almeida · 16 comments
Member

System Information
Operating system: Linux-5.4.43-x86_64-Intel-R-_Core-TM-i7-7500U_CPU@_2.70GHz-with-slackware-14.2 64 Bits
Graphics card: Mesa Intel(R) HD Graphics 620 (KBL GT2) Intel 4.6 (Core Profile) Mesa 20.1.0

Blender Version
Broken: version: 2.91.0 Alpha, branch: master, hash: f470a02afa, commit date: 2020-09-20 05:59
Worked: version: 2.91.0 Alpha, branch: master, hash: 66078594d1

Short description of error
When drawing images with the python gpu module, they will no longer draw on top of the region's contents or of other python rendering.
This problem happens in the Image Editor, but not the Sequence Editor.

Before:
(2 square images and a circle are drawn with Python, 'POST_PIXEL' in the Image Editor, which shows a rectangular image)
happy_froggo_good.png

After:
(the circle, drawn first, shows on top. The Image Editor's image also shows on top)
happy_froggo_bad.png

Exact steps for others to reproduce the error
See the attached .blend file.
python_gl_draw_image.blend

**System Information** Operating system: Linux-5.4.43-x86_64-Intel-R-_Core-TM-_i7-7500U_CPU_@_2.70GHz-with-slackware-14.2 64 Bits Graphics card: Mesa Intel(R) HD Graphics 620 (KBL GT2) Intel 4.6 (Core Profile) Mesa 20.1.0 **Blender Version** Broken: version: 2.91.0 Alpha, branch: master, hash: `f470a02afa`, commit date: 2020-09-20 05:59 Worked: version: 2.91.0 Alpha, branch: master, hash: `66078594d1` **Short description of error** When drawing images with the python gpu module, they will no longer draw on top of the region's contents or of other python rendering. This problem happens in the Image Editor, but not the Sequence Editor. Before: (2 square images and a circle are drawn with Python, 'POST_PIXEL' in the Image Editor, which shows a rectangular image) ![happy_froggo_good.png](https://archive.blender.org/developer/F8903609/happy_froggo_good.png) After: (the circle, drawn first, shows on top. The Image Editor's image also shows on top) ![happy_froggo_bad.png](https://archive.blender.org/developer/F8903608/happy_froggo_bad.png) **Exact steps for others to reproduce the error** See the attached .blend file. [python_gl_draw_image.blend](https://archive.blender.org/developer/F8903627/python_gl_draw_image.blend)
Author
Member

Added subscriber: @brita

Added subscriber: @brita
Member

Added subscriber: @Jeroen-Bakker

Added subscriber: @Jeroen-Bakker
Member

Could this be related to the depth tricks that the image editor currently uses? https://wiki.blender.org/wiki/Source/EEVEE_%26_Viewport/Draw_Engines/Image_Engine#Depth_Buffer
What happens when you draw with DEPTH_ALWAYS on? Or with write depth.

Currently when drawing via python it draws directly to the overlay buffer. https://wiki.blender.org/wiki/Source/EEVEE_%26_Viewport/GPU_Module/GPUViewport when transferring to display it might not have the correct data inside the buffers.

I will check later today with renderdoc to see what is happening and what needs to be corrected/documented.
Thanks!

Could this be related to the depth tricks that the image editor currently uses? https://wiki.blender.org/wiki/Source/EEVEE_%26_Viewport/Draw_Engines/Image_Engine#Depth_Buffer What happens when you draw with DEPTH_ALWAYS on? Or with write depth. Currently when drawing via python it draws directly to the overlay buffer. https://wiki.blender.org/wiki/Source/EEVEE_%26_Viewport/GPU_Module/GPUViewport when transferring to display it might not have the correct data inside the buffers. I will check later today with renderdoc to see what is happening and what needs to be corrected/documented. Thanks!
Member

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

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

This issue was referenced by 085329f114

This issue was referenced by 085329f114beb904ed3ef0c8ec6894ee26916704
Member

The circle is rendered with gl_depth 0, write depth is on and depth function is less equal.
The textures are rendered with gl_depth 1, write depth is on and depth function is less equal.
The image of the image editor is drawn using gl_depth of 0.75 as part of the new draw pipeline.

Looking at https://developer.blender.org/diffusion/B/browse/master/source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl the gl_depth is set to 1 for images so they always render in the background.
This was introduced by https://developer.blender.org/rB648924333234a1fd0fee91851bb7ad8bc8639f3a what seems to be out dated as we have done several overhauls in this area. (workbench refactor, overlay engine refactor, color management pipeline).

The circle is rendered with gl_depth 0, write depth is on and depth function is `less equal`. The textures are rendered with gl_depth 1, write depth is on and depth function is `less equal`. The image of the image editor is drawn using gl_depth of 0.75 as part of the new draw pipeline. Looking at https://developer.blender.org/diffusion/B/browse/master/source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl the gl_depth is set to 1 for images so they always render in the background. This was introduced by https://developer.blender.org/rB648924333234a1fd0fee91851bb7ad8bc8639f3a what seems to be out dated as we have done several overhauls in this area. (workbench refactor, overlay engine refactor, color management pipeline).
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Jeroen Bakker self-assigned this 2020-09-22 11:21:15 +02:00
Member

Changed status from 'Resolved' to: 'Confirmed'

Changed status from 'Resolved' to: 'Confirmed'
Member

Reopening as this fix will be reverted. #81212 (Some Viewport Overlay is gone if you move the view in Cycles render view)

Reopening as this fix will be reverted. #81212 (Some Viewport Overlay is gone if you move the view in Cycles render view)

This issue was referenced by 32d4a67017

This issue was referenced by 32d4a67017ecf4af75a9bfde885526550a6534ba
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Member

Changed status from 'Resolved' to: 'Confirmed'

Changed status from 'Resolved' to: 'Confirmed'
Jeroen Bakker removed their assignment 2020-10-20 13:55:34 +02:00

Added subscriber: @OtherRealms

Added subscriber: @OtherRealms

A heads up, drawing images in POST_VIEW doesn't work at all in the 2.92 Image Editor, could this be related? I've tried various z positons without success in this case though it works fine in 2.91.

A heads up, drawing images in POST_VIEW doesn't work at all in the 2.92 Image Editor, could this be related? I've tried various z positons without success in this case though it works fine in 2.91.

This issue was referenced by 89abc14d6c

This issue was referenced by 89abc14d6ce92dd5fd8cd32885d379d46f017f81

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Germano Cavalcante self-assigned this 2022-09-05 17:36:19 +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
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#81002
No description provided.