pypi pygfx 0.13.0
v0.13.0

latest releases: 0.17.0, 0.16.0, 0.15.3...
13 months ago

Introduction

This release represents a lot of work on refactoring how PyGfx deals with transparency. We recommend reading https://docs.pygfx.org/latest/transparency.html to learn how PyGfx works now.

The most important changes related to transparency:

The renderer.blend_mode is no more. Some modes like the 'ordered2' and 'weighted_plus' no longer exist. Instead, you can now set material.alpha_mode on each object separately. Yes, you can mix different modes in the same scene.

It does mean that as a user you'll have to be a bit more aware of whether your objects are transparent, and how to approach that. In short, the default material.alpha_mode='auto' works fine for opaque and most semi-transparent objects, as well as for objects that have mixed opaque/transparent fragments. But if you know your object is opaque, use alpha_mode='solid', and if it's transparent, use alpha_mode='blend'. For more context check https://docs.pygfx.org/latest/transparency.html#a-quick-guide-to-select-alpha-mode

We also changed some things on how we approach anti-aliasing:

  • The SSAA (super-sample anti-aliasing) that we already applied now uses an improved filter (the Mitchell filter). The same improved filter is also used for upsampling. Also see the new renderer.pixel_scale and renderer.pixel_filter.
  • We added support for PPAA (post-processing anti-aliasing) to improve the smoothness of the rendered result. It's enabled by default. See the new renderer.ppaa.
  • The material.aa for text lines and points is now off by default, to prevent blending artifacts. Though we recommend turning it on for text for higher quality glyphs.
  • See https://docs.pygfx.org/latest/aa.html for details.

API changes

Objects and materials:

  • Removed WorldObject.render_mask.
  • Added Material.alpha_mode, default is 'auto'.
  • Adeded .alpha_config, .alpha_method (setting alpha_mode also sets these).
  • Added Material.render_queue, default is None (auto).
  • Added Material.depth_write, default is None (auto).
  • Added `Material.depth_compare, default is "<".
  • Added Material.alpha_test.
  • Added Material.alpha_compare, default is "<".
  • Removed material.color_is_transparent for Line, Mesh, Points, Text. Use material.color.a < 1 instead.
  • Removed material.edge_color_is_transparent for Points. Use material.edge_color.a < 1 instead.
  • Removed material.outline_color_is_transparent for Text. Use material.outline_color.a < 1 instead.

Renderer:

  • Removed Renderer.blend_mode.
  • The renderer.sort_objects is True by default.
  • The renderer's sorting logic is completely overhauled.
  • Added renderer.effect_passes.
  • Added renderer.ppaa.
  • Added renderer.pixel_scale.
  • The renderer.pixel_filter is now a string instead of an int.
  • Added renderer.clear() to clear render targets.

Commits

Changes related to transparency and anti-aliasing

Changes to the engine

Other changes

New Contributors

Full Changelog: v0.12.0...v0.13.0

Don't miss a new pygfx release

NewReleases is sending notifications on new releases.