(approximated) Order independent transparency

I’ve apploaded sample project onto bitbucket/github under MIT license.

https://neginfinity.bitbucket.io/2017/04/weighted-blended-transparency.html#weighted-blended-transparency
https://github.com/NegInfinity/WeightedBlendedTransparency
https://bitbucket.org/neginfinity/weightedblendedtransparency

The issues I have encountered haven’t been fixed, and the project is unsupported.

Enjoy.

—previously—
I developed (approximated) order independent transparency shader.

Wanted to publish it on asset store BUT encountered certain technical problem which prevented that from happening (for now, anyway).

Here are videos of the effect in action.

Watch the cursor in bottom left cursor - it toggles various options. “Standard” (enabled at 1:03) demonstrates standard way of handling transparency, without order-independence.

2 Likes

How is this different from normal transparency?

Normal transparency requires objects to be sorted. This one doesn’t.

In case of standard transparency, if you make several meshes that cannot be properly sorted by depth, (if they intersect, or if one object is within another), one object will “overdraw” another. This is demonstrated at 1:03 when I switch to standard transparency (smoke passes through other objects in the scene, and because it is considered to be “closer” to the camera than everything else, it is drawn last ,completely erasing car and standing character).

In case of standard transparency you’ll also get artifacts on complex concave object (like car’s hull) with lighting on it, unless you split that object into many small parts - because sorting is performed on object level and not polygon level.

However, it is still an approximation.

Also, in the example, particle smoke reacts to unity lighting and receives shadows.

I think I’ll need to make better demonstration.

I’ve added new demo, supposedly better one.

Cool, that shows the benefits quite well. So unity is not able to do proper transparency like this on its own?

Unless you split it into many small meshes, no.

This is very interesting, I can think of lots of potential applications.

What is the performance cost vs standard unity transparency?

You know what, I have live demo here, so see for yourself. It is older demo that doesn’t work in OpenGL.

It should actually be really cheap, BUT
Unity does not exactly let you reuse zbuffer (used by previously drawn objects - it just plain doesn’t work in DirectX mode), so currently currently all solid objects will have to be drawn second time (with cheap shader) for the the effect to work.
It is still much cheaper than proper non-approximated order independent transparency would have been.

I also spent a lot of time trying to make lighting work on transparent objects (in 1st demo you can see shadows on semi-transparent car), it cannot be reliably done (without replacing unity lighting system with your own) because it does not work in OpenGL mode (and probably relies on undefined behavior in DX).

You also cannot use the effect on standard unity shader unless you rewrite it.

What kind of tehnique you use? =)
About zbuffer… why don’t use depth textures? Copy them by blit… I think it’s more usefull than render solid geometry one more time.

I’ve just released a shader with support for Order Independent Transparency.

It uses pixel lists. If you have any questions feel free to ask me.

You know, the reason why I never released the original asset is because I couldn’t make it work on OpenGL and there were problems with support for receiving shadows.

Guess now I’ll have to get it together and release it for free.

3 Likes

We tried this Weighted Blended OIT code: https://github.com/candycat1992/OIT_Lab. Can you compare your solution with this?

3033146--226950--OITWB.jpg

Alright. Uploaded it. The project is unsupported and more of a “proof of concept”.

It uses blended weighted transparency algorithm.

1 Like

Hi,
i am interessted on your OIT Asset for BuiltIn RP.
Did you have an idea for MSAA?

Another question for HDRP.
Do you know a method to apply oit to the HDRP hair shader?
https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@7.1/manual/Master-Node-Hair.html