Experimental Alpha Composite Exploration

Hi everyone!

This is a experimental alpha composite suggestion that I don’t know how to make.
To clarify: My suggestion is partly the “Partially Transparent A and B” but the alpha that has a higher value is only rendered and all pixels under it are masked out.

If anyone has any suggestions where to look or if there exist a similar type of shader/material let me know.

I am thinking that this could be a powerful tool/function when having a lot of low opacity particles like dust or smoke.

I am mainly using Unity, but could be valuable knowing how it works in unreal because I am starting to get quite familiar how it works.

Thanks again

I’m actually a little confused by what you’re asking. Do you want to know how to make UE4 sort particles based off of their opacity level?

I think what you mean is that one could use variation in literal dust opacity as the driver for final pixel color instead of dust density. (Which is what particle shaders tend to do right now (srcAlpha + oneMinusDstAlpha).

If any shader has a greater than blending option, that might work. But it will probably have some really weird artifacts with any other opacity based item in the scene.

In unity,

BlendOp Max might do something similar to what you are asking.

I have no idea if unreal has something like this, but I imagine if you want to acces source code you could easily write this functionality yourself during blending in the render pipeline.

Is this kind of what you are looking for?

1 Like

As I see it you are presenting a method for minimizing overdraw. So never would one particle be drawn over another particle, even though they both are partially transparent?

It looks like he’s going for how Wind Waker handled it’s transparency, where you can’t see particles behind other particles, even if they’re transparent.

Seeing as Chris’ other work seems pretty Wind Waker inspired I’m guessing this is the effect he’s trying to achieve.

Thank you all for the answers.

@Niels
Those links and comments you added certainly seems related to what I am looking for.
I still haven’t been able to do proper research but I intend to do it, Thank you for digging this for me.

@CellarPhantom
Its not necessarily to optimize, its overlapping of particles I want to get rid of. If it would potentially optimize the render that would be great!

@TheVman
Exactly! the windwaker game seems to have gotten the effect just right. Thanks for showing a clear reference.
Sadly the tutorial do not seem to include that alpha solution:

@NateLane
Yes, but I want to them mask out everything behind similar to how the windwaker explosion in @TheVman’s link showcased :slight_smile:

Yea Wind Waker’s the only game I’ve seen to do such a thing with it’s alpha. Though from what I can tell, they seem to have some system where you can scale the alpha of an entire particle emitter uniformally, rather than having the particles scale individually. All of the particles in the core smoke of the explosion fade alpha at the same time, so I doubt the effect would work correctly if they had staggered lifetimes.
Meanwhile other effects in Wind Waker, such as the debris trails from the explosion seem to have far more typical alpha sorting.

You can see here the debris trails overlapping as their alpha fades.

1 Like

nice, good spot!

Thanks for pointing that out, that could help with what type of potential restrictions one might encounter when trying to build a similar shader!