pygfx.renderers

Objects to draw a scene onto a canvas.

The purpose of a renderer is to render (i.e. draw) a scene to a canvas or texture. It also provides picking, defines the anti-aliasing parameters, and any post processing effects.

A renderer is directly associated with its target and can only render to that target. Different renderers can render to the same target though.

It provides a .render() method that can be called one or more times to render scenes. This creates a visual representation that is stored internally, and is finally rendered into its render target (the canvas or texture):

                          __________
                         | blender  |
[scenes] -- render() --> |  state   | -- flush() --> [target]
                         |__________|

The internal representation is managed by the blender object. The internal render textures are typically at a higher resolution to reduce aliasing (SSAA). The blender has auxilary buffers such as a depth buffer, pick buffer, and buffers for transparent fragments. Depending on the blend mode, a single render call may consist of multiple passes (to deal with semi-transparent fragments).

The flush-step resolves the internal representation into the target texture or canvas, averaging neighbouring fragments for anti-aliasing.

WgpuRenderer(target, *args[, pixel_ratio, ...])

Turns Scenes into rasterized images using wgpu.

SvgRenderer(width, height, filename)

Turns scenes into SVG images.

print_wgpu_report()

Print a report on the internal status of WGPU.