TLDR: Eye Dome Lighting and Translucency don’t work well in different combinations. Is this a bug? Is there a workaround?
I render point clouds with a custom shader and apply an alpha value for translucency / transparency.
I noticed that the alpha value is interpreted differently depending on the translucencyMode
for the custom shader:
Cesium.CustomShaderTranslucencyMode.TRANSLUCENT
: The alpha value seems to be “per point”, i.e., if more points overlap, they accumulate their alpha values. So sparse parts of the point cloud are more transparent than dense parts.Cesium.CustomShaderTranslucencyMode.OPAQUE
: The point cloud is rendered, seemingly with a depth buffer discarding fragments that are overlapped by others. Then, the alpha value is applied to the remaining fragments. That means that the point cloud has the same transparency regardless of how many points had overlapped.
This is fine so far, I need both options to be switchable in my local app.
Eye Dome Lighting (EDL)
I created a Sandcastle for that, adapted from the point cloud shading showcase.
Now it seems that the CustomShaderTranslucencyMode.TRANSLUCENT
mode does not allow Eye Dome Lighting. I guess this happens because there is no proper depth info, and thus the edges cannot be calculated. This is okay for me.
CustomShaderTranslucencyMode.OPAQUE
works with Eye Dome Lighting:
However, it seems that it only works with Eye Dome Lighting. If I switch EDL off, the whole point cloud is rendered opaque, ignoring the assigned alpha value.
This seems like a bug to me. I would have expected that the black edges calculated by the EDL just disappear, and the transparency stays.
Is there a way to make that work? Maybe some workaround?
Any help is appreciated!