Need help with depth peeling interfering with screen shader effect #528
-
I am working on a fairly advanced outline renderer (Because the builtin one doesn't fit my needs). When the lines are opaque, all is good (and transparent objects even work correctly when transparency is enabled): However, when the outline is transparent, the outline of objects behind is also drawn for some reason: I believe the issue is related to depth peeling, since disabling transparency on all the objects fixes the issue.
Here is my project: |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
I found the cause of my problem: the depth peeling (correctly and as expected) blends the outline color buffer: |
Beta Was this translation helpful? Give feedback.
-
I can't figure out a solution that works with the depth peeling implementation, however I can think of a way to make it work by sorting everything from back to front and drawing it with regular Z buffering, so I'm going to close this remarkably unhelpful discussion and start working on a custom render pipeline to do that. |
Beta Was this translation helpful? Give feedback.
-
While transparency being blended on top of anything behind is indeed the intended behavior, you can do some workarounds to avoid it: Here what I'm doing is adding 2 extra outputs to the RenderLayers graph. I simply set the line alpha to 1 in a screen shader and store the actual alpha in a separate output. This way lines are composed as opaque, but I can apply the alpha later in the Render graph. It's not the most efficient way to do it, but it works with just nodes. If you want to code a more bespoke solution keep in mind you don't have to go with a fully custom pipeline, you can simply implement your own BTW, I've updated the line compositing in the Development branch, since I noticed transparent lines were not working correctly. |
Beta Was this translation helpful? Give feedback.
-
Making my own |
Beta Was this translation helpful? Give feedback.
While transparency being blended on top of anything behind is indeed the intended behavior, you can do some workarounds to avoid it:
Here what I'm doing is adding 2 extra outputs to the RenderLayers graph. I simply set the line alpha to 1 in a screen shader and store the actual alpha in a separate output. This way lines are composed as opaque, but I can apply the alpha later in the Render graph.
line-no-alpha-compositing.zip
It's not the most efficient way to do it, but it works with just nodes. If you want to code a more bespoke solution keep in mind you don't have to go with a fully custom pipeline, you can simply implement your own
RenderLayers
node in a plugin.BTW, I've updated the …