-
-
Notifications
You must be signed in to change notification settings - Fork 56
Description
In pygfx you can independently pick a blending method, and toggle scene sorting. If you enable scene sorting, and select the
ordered2
blender, you'll get the expected result.
In the current main branch, the renderer does not distinguish between transparent and opaque objects. Even with sorting enabled, the transparent and opaque objects are sorted together from near to far based on their z-values, resulting in incorrect rendering.
Additionally, I've always had reservations about Blender's approach. Ordered2 Blender renders the scene twice using two passes, discarding transparent and opaque fragments separately, and then combines the results. This method incurs significant performance overhead. (Firstly, it rendered twice, and secondly, the "discard" operation disrupted the Early-Z capability of the GPU.).
The only potential advantage I can see is that the renderer doesn't need to distinguish between transparent and opaque objects or manage their rendering order. However, as mentioned earlier, without proper sorting, transparent objects often result in incorrect alpha blending outcomes.
Originally posted by @panxinmiao in #974 (comment)