Shadow rendering issue with transparency

I find the shadow visibility feature to be so good, I love it but
is it possible to make the effect stronger / weaker?
I wish it were not ON by default
it has an issue when segments are transparent. The attached pic is an example, in reality, it looks worse. the overlapped areas look dark/blurred. ( anterior mandible and ramus)

Yes - see here. I just did not get around to integrate this improvement.

It is configurable. You can set it to be on or off by default in application settings / Views / Shadows visibility.

There are some limitations.

Transparent surfaces don’t cast a shadow, so even if you set your opacity to 99%, you won’t see any shadow casted by that model. This can be considered either a feature or a limitation (it may be useful in some cases).

Depth peeling does not seem to work when shadows are enabled. This can be probably fixed, but most likely would need dedicated funding sent to Kitware.

thank you for your reply
What is depth peeling? I can’t figure out what it does!

Depth peeling is required for correct display of transparent surfaces (surfaces need to be ordered based on distance from camera).

Note that you may be able to avoid transparency related issues and have much higher fidelity rendering if you use “Colorize volume” module (it displays the result of segmentation combined with the original image).

1 Like

This reminded me a related issue so if you don’t mind I just join this discussion.

When using transparency, I frequently see artifacts like this. Any idea what these might be and how to mitigate them? Thank you very much!

What you show looks like depth peeling is disabled.

It is a known issue that if shadows are enabled then depth peeling does not seem to work:

Is it the issue that you are seeing?

I cannot confirm if this is what I see - I don’t know what kind of arfiact the lack of depth peeling would cause in this case. Although I can confirm that this artifact is only visible with the shadows enabled, and if I disable SSAO they disappear too.

I saw the ticket yesterday, thanks for creating it! If there is a way to at least verify if depth peeling is the issue here, please let me know and I’ll investigate. Thank you!

You can confirm by disabling shadows and toggling depth peeling on and off. If disabling depth peeling produces the same artifacts then it means that the problem is due to depth peeling ineffective or not performed when shadows are enabled.

It may be due to shadows messing up the z buffer, rendering passes missed or performed in the wrong order, or maybe combination of shadows+depth peeling would require implementing some special combined shader code.

@LucasGandel is it expected that SSAO interferes with depth peeling?

I’ve been following the discussion but need to perform a few tests locally and check the current order of passes before pointing you in the right direction. I also recall SSAO was interfering with the translucent pass in VTK but thought it had been fixed. I’ll try to dig a bit into this in the coming days and will share updates, but your statement is definitely correct:

2 Likes

This I tried, but there were no such artifacts. It may be possible though that depth peeling of the shadows themselves produce these, but that’s the part I cannot confirm.

Much appreciated @LucasGandel !

I showed @lassoan this artifact, and the conclusion was that it is indeed the depth peeling. I only kept the jaw bone segment, and in this video you can see that the far side of the jaw, while rotating along AP, became “in front of” the near side, causing the artifact. In the second half of the video I disabled SSAO (this part is not shown in the video as the panel is not in the view) and then also disable depth peeling (this can be seen though), and then a similar effect can be seen, the only difference is that the shadows are not added, so it is not that emphasized.

Sorry for the late reply. I am still not sure what is exactly producing the artefacts you initially reported @cpinter, but at least I could investigate the issue mentioned by @lassoan which is the root cause for the transparent models not being supported with shadows. For the record, I answered on the issue directly: Semi-transparent models are not rendered correctly if shadows visibility is enabled · Issue #7780 · Slicer/Slicer · GitHub

1 Like

new issue i had today

shoadow visibilty ON , depth peel OFF

shoadow visibilty OFF , depth peel OFF

i found a use for the transparency issue i mentoed bedore @lassoan .

here im using teeth as opaque and jaw as transparent . i can alter the shadow on the solid object and it seems to make a good visualization .
like only altering lightining parameter on one object .

is that possible other way , was this intedned ?

thanks