How to setup materials with transparency (blend) in a way that z-sorting works

… and it looks correct independent of the camera position. I just cant’t figure it out.
A patch demonstrating the issue:
Transparency.7z (86.5 KB)

it seems to work fine in the patch. but sorting only works per object center, not per pixel. so whether it looks right or wrong depends highly on how the shape of the meshes and where their pivot points are.

so on steep camera angles, you will have these flips because the object center points change the order in relation to the camera. what you can try to do is model the meshes in a way that their center is the objects center of mass, which would lead to much better sorting than when they have their center at a common place.

here is an example case that works:

AlphaMaterialAndSortingPlanes.vl (28.4 KB)

Connecting a value (ValueIn [Stride.Materials.Inputs]) to the Alpha pin on the blend node in bjoern’s patch causes it to behave more appropriately for me (for whatever reason).

The tool should, as much as possible, conform to the user and follow the rules of our shared objective reality that it is based on.

Hi,

the problem happens even with just one simple box and a texture with alpha.

Gee clone, 2022 and the most popular question is the same ;)
Basically there is no transparency on the same draw call, e.g. object cannot be transparent to itself unless it ordered from back to front… The same apply to Instancing (since for GPU is same drawcall)
The transparency between draw calls is possible, however, it works if there is no depthbuffer or objects ordered from back to front…

Think stride has some kind of zSorting under the hood but it works against objects bounding box, e.g. sorts by distance from camera to center of objects (witch is not going to work if there is one object)

Second in your case you can try to use Alpha to Coverage, but you not going to get semi transparent sides between each other…

1 Like

Right, I did know that but wasn’t use to strides nodes and VL stuff enough. But now I got it since the devvvvs pointed towards this documentation :

which lead to this :
https://doc.stride3d.net/4.0/en/manual/graphics/materials/misc-attributes.html#transparency

So I ended using Cutoff with the PBR pipeline for situation where a gradient alpha isn’t needed.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.