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_scaleandrenderer.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.aafor 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(settingalpha_modealso 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_transparentforLine,Mesh,Points,Text. Usematerial.color.a < 1instead. - Removed
material.edge_color_is_transparentforPoints. Usematerial.edge_color.a < 1instead. - Removed
material.outline_color_is_transparentforText. Usematerial.outline_color.a < 1instead.
Renderer:
- Removed
Renderer.blend_mode. - The
renderer.sort_objectsis 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_filteris now a string instead of an int. - Added
renderer.clear()to clear render targets.
Commits
Changes related to transparency and anti-aliasing
- Simplify blending by @almarklein in #1002
- Add support for post-processing effects by @almarklein in #1114
- Improve the interpolation filter in flush by @almarklein in #1121
- Fix that snapshot may not include the last effect by @almarklein in #1126
- Syncing ssaa.wgsl by @almarklein in #1131
- Improve dithered alpha_mode by @almarklein in #1139
- Add support for FXAA and DDAA by @almarklein in #1117
- remove unused variable in image_stitching example by @hmaarrfk in #1143
- Add docs for blending by @almarklein in #1124
- Implement material.alpha_mode to replace .blending and .transparent by @almarklein in #1144
- Allow calling renderer.clear(depth=True, color=True) by @hmaarrfk in #1170
- Rename alpha-method 'composite' to 'blended' by @almarklein in #1172
- Add renderer.pixel_scale by @almarklein in #1174
- Turn off material.aa by default by @almarklein in #1171
- Enable weighted blending between calls to render by @hmaarrfk in #1148
- Add docs on aa by @almarklein in #1173
- Make background use alpha_mode and render_queue correctly by @almarklein in #1180
- Add material.alpha_method (readonly) by @almarklein in #1184
- Refactor logic related to 'auto' mode by @almarklein in #1186
- Tweak docs by @almarklein in #1188
- Add arg to Ruler for alpha_mode of child objects by @almarklein in #1189
- Remove that material.opacity affects alpha logic by @almarklein in #1190
- Small tweak to docs of render_queue by @almarklein in #1194
Changes to the engine
- Add support for custom orbit center in OrbitController by @panxinmiao in #1115
- Cloth Simulation with Compute Shaders by @panxinmiao in #1116
- Fix that the ruler did not take world transform into account by @almarklein in #1130
- update roll by @sawbz in #1134
- Fix pan in orbit controller by @almarklein in #1135
- fix GLTFMaterialsSheenExtension by @panxinmiao in #1150
- Fixed some edge cases in the Interpolant by @panxinmiao in #1154
- Implement GpuCache with LRU strategy (split from #974) by @panxinmiao in #1142
- Add
EXT_texture_webpsupport by @panxinmiao in #1155 - Support
KHR_draco_mesh_compressionby @panxinmiao in #1159 - Fix keyframe optimization by @panxinmiao in #1166
- Fix docstring of get_bounding_box by @almarklein in #1178
- Make sure the pick face coords add up to one by @almarklein in #1179
- Support GLTF alphaMode by @almarklein in #1177
- Dereference world-object in case its a weakproxy by @almarklein in #1183
- Can use wgpu 0.23 by @almarklein in #1193
Other changes
- Use rendercanvas in all our examples by @almarklein in #1127
- Minor tweaks to avoid warnings in CI by @almarklein in #1129
- Fix vertical text because uharfbuzz 0.51 broke something by @hmaarrfk in #1151
- Update uharfbuzz constraint for future proofing by @hmaarrfk in #1152
- Adjust how version is reported when one checkouts a tag by @hmaarrfk in #1153
- Update validation example screenshot by @almarklein in #1161
- updated "expected 1.0" to 1 year from today by @hmaarrfk in #1160
- Add dedicated email address to coc by @almarklein in #1181
- Update _version.py by @almarklein in #1185
- Add slotscheck to CI by @almarklein in #1187
- Switch to trusted publishing for PyPI publish in CI by @EpicWink in #1192
New Contributors
Full Changelog: v0.12.0...v0.13.0