Skip to content
Discussion options

You must be logged in to vote

After some more looking around I found a solution in the discussion in #318. For future reference, here is a modified version of the offscreen.py example which extracts the rendered image as float32. Since the solution thread is quite old, let me know if there is a nicer way to achieve this (e.g. rendering into a Texture?).

import imageio.v3 as iio
import numpy as np
import wgpu
import pygfx as gfx
import pylinalg as la
from wgpu.gui.offscreen import WgpuCanvas
import matplotlib.pyplot as plt

def snapshot(renderer):

    device = renderer._shared.device
    texture = renderer._blender.color_tex
    size = texture.size
    bytes_per_pixel = 16

    data = device.queue.read_texture(
      …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by csabaj
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants