Page MenuHome

offscreen.draw_view3d is washed out
Closed, ResolvedPublicBUG

Description

Blender Version
Broken: version: 2.83 (sub 5), branch: master, commit date: 2020-02-28 01:33, hash: rBe98f94d778ef
Worked: 2.82

Short description of error

Exact steps for others to reproduce the error
The gpu offscreen viewport drawing is washed out.

Run the sample file from:
https://docs.blender.org/api/master/gpu.html#rendering-the-3d-view-into-a-texture

import bpy
import bgl
import gpu
from gpu_extras.presets import draw_texture_2d

WIDTH = 512
HEIGHT = 256

offscreen = gpu.types.GPUOffScreen(WIDTH, HEIGHT)


def draw():
    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)

    bgl.glDisable(bgl.GL_DEPTH_TEST)
    draw_texture_2d(offscreen.color_texture, (10, 10), WIDTH, HEIGHT)


bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')

2.82:

2.83 alpha / master:

Revisions and Commits