0
$\begingroup$

Running one of the examples provided in the GPU Shader Module documentation works as expected.

For example:

import bpy
import gpu
from gpu_extras.batch import batch_for_shader

coords = [(1, 1, 1), (-2, 0, 0), (-2, -1, 3), (0, 1, 1)]
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'LINES', {"pos": coords})

def draw():
    shader.bind()
    shader.uniform_float("color", (1, 1, 0, 1))
    batch.draw(shader)

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

In the viewport this looks as follows (see the yellow lines):

enter image description here

However, if I render the scene with

enter image description here

I receive the following result (i.e. the yellow lines are missing) enter image description here

Is there an option to render the lines together with other Blender objects (such as the cube and the camera)?

| improve this question | | | | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.