Python API: Expose background drawing as argument for gpu.types.GPUOffScreen.draw_view3d() #105748
No reviewers
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#105748
Loading…
Reference in New Issue
No description provided.
Delete Branch "Yuntoko/blender:expose-draw-background-pyapi"
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?
Currently, when using the python api for offscreen drawing, the default background will always be rendered into the GPUOffScreen's framebuffer, rendering the alpha channel essentially useless and making it difficult to separate objects from the background.
This patch allows offscreen drawing of a 3d view with transparent background by exposing an optional parameter to the python api, enabling, for example, compositing the result over another image.
The new parameter to draw_view3d() is optional, with the default value matching the previous behavior, so this change is fully backwards-compatible.
This function is old, I'm not familiar with the draw_background parameter.
If enabled, does it reuse the current offscreen color slot?
If that's the case, I think the parameter name could be "clear_color=True".
But I'm still not sure of the motivation for this change. Isn't it better to avoid adding more parameters to
draw_view3d
in order to simplify the API? Why not simply redraw the result with alpha over an background texture?the draw_view3d is a legacy function. And when the background is drawn the transparency data isn't available to do the compositing. The background actually is drawn with an alpha under replacing all alpha values.
Yes we should make a new API for offscreen rendering that would be more configurable currently it isn't clear how this will look like. The new API would also consider overlays etc. I am fine to add this optional parameter for now.
Usecase is same as for other cases where draw_view3d is used, mostly for automation in pipelines where speed is desired or where compositing isn't executed in Blender.
@ -304,2 +304,3 @@
" :arg do_color_management: Color manage the output.\n"
" :type do_color_management: bool\n");
" :type do_color_management: bool\n"
" :arg draw_background: Draw background.\n"
This description is not adding much.
@blender-bot build