Blender messes up with framebuffers in custom OpenGL renderer #90116
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#90116
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?
System Information
Operating system: Linux-5.8.0-63-generic-x86_64-with-glibc2.31 64 Bits
Graphics card: GeForce RTX 2060 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.91.03
Blender Version
Broken: version: 2.93.0, branch: master, commit date: 2021-06-02 11:21, hash:
84da05a8b8
Worked: None. Does not work on 3.0 neither
Short description of error
Custom OpenGL-based renderer is inconsistent when using complex framebuffers. Result depends on blender window configuration and context.
Exact steps for others to reproduce the error
Install
pyopengl
module for blender's python withpip install pyopengl
Open attached
renderengine_bug.py
in blender and run the scriptrenderengine_bug.py
It will add a custom OpenGL-based renderer called GLRender in Blender's UI.
Try to render with
bpy.ops.render.render('EXEC_DEFAULT')
from Blender python console. It should render and after completion create 3 images corresponding to different outputs of fragment shader. Note that they all have different types - vec4, vec3 and float.If you try to repeat that with Image Editor opened then for some reason only first attachment of the framebuffer seems to be drawn into, so images gl_1 and gl_2 are empty. If you have 3d viewport opened then again, everything renders as it should.
Rendering with
bpy.ops.render.render('INVOKE_DEFAULT')
always works fine.So for some reason, the result of my OpenGL renderer depends on a window configuration of blender. So I might assume that some color attachments are reserved by blender or something. I am not 100% fluent with OpenGL, but when trying this code in a standalone python, everything is consistent.
Also note that attachments which have type vec4 are always rendered fine. So if you try to change type of col1 or col2 to vec4 and change fragment shader correspondingly, they are always render as should. So the problem is present only for outputs with types float, vec2, vec3.
I also uploaded a video demonstrating the problem:
2021-07-25 11-23-02.mp4
I have an almost exact renderer using blender's
gpu
module, where multiple framebuffer attachments works fine. I still cannot use that module completely as extracting data from gputextures to blender images is super slow compared to pyopengl+numpyAdded subscriber: @blendersamsonov
Added subscriber: @OmarEmaraDev
Changed status from 'Needs Triage' to: 'Needs User Info'
I either get corrupt data on the second and third attachment or I get zero data in software mode.
I am not sure if the code is correct to classify this as a bug, however.
All your attachment textures have a type of
GL_RGBA32F
but you write float and vec3 outputs in the fragment shader. Is that correct?Can you also attach the gpu module version of your script?
Just a poke regarding my inquiry above, otherwise we will have to archive this for now.
Changed status from 'Needs User Info' to: 'Archived'
No activity for more than a week. As per the tracker policy we assume the issue is gone and can be closed.
Thanks again for the report. If the problem persists please open a new report with the required information.