Python API example "rendering-the-3d-view-into-a-texture" doesn't work. #92238
Labels
No Label
Meta
Good First Issue
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 & Devices
Module
Python API
Module
Rendering & Cycles
Module
Sculpt, Paint & Texture
Module
User Interface
Module
VFX & Video
Priority
High
Priority
Low
Priority
Normal
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Information 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-manual#92238
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: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce GTX 470/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 391.35
Blender Version
Broken: version: 3.0.0 Alpha, branch: master, commit date: 2021-10-13 21:57, hash:
blender/blender@9dff3de6ac
Worked: (newest version of Blender that worked as expected)
Short description of error
No window is produced when running the following example code from the python API documentation:
https://docs.blender.org/api/master/gpu.html#rendering-the-3d-view-into-a-texture
Checking the console reveals:
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
File "\Text", line 20, in draw
Exact steps for others to reproduce the error
Run the following code in the scripting workspace.
context = bpy.context
scene = context.scene
view_matrix = scene.camera.matrix_world.inverted()
projection_matrix = scene.camera.calc_matrix_camera(
context.evaluated_depsgraph_get(), x=WIDTH, y=HEIGHT)
offscreen.draw_view3d(
scene,
context.view_layer,
context.space_data,
context.region,
view_matrix,
projection_matrix,
True)
gpu.state.depth_mask_set(False)
draw_texture_2d(offscreen.texture_color, (10, 10), WIDTH, HEIGHT)
Changing the 7th argument on line 27 from
True
todo_color_management=True
allows the script to run. As Python knowledge isn't my specialty, I am not sure if simply updating the example to usedo_color_management=True
is the proper fix, or if this error reveals a deeper issue.Added subscriber: @EAW
This issue was referenced by blender/blender@138fdf78ba
Changed status from 'Needs Triage' to: 'Resolved'