, 9 tweets, 4 min read Read on Twitter
Finally added alpha dithering to our particle shaders! @Skepsisology has been requesting this for ages.
We use it for 2 things: fading out smoke that's too close to the camera, and fading out smoke over lifetime.
Here's how we did it (THREAD):
#gamedev #unitytips #madewithunity
Btw here's the YouTube version that doesn't suffer from Twitter's video compression so you can see the effect clearly (2/9)
Firstly, fading out particles close to the camera. In the vert function we get the distance between the world space vertex and the camera position, and normalize that with our desired dithering distance (3/9)
In the surface (or fragment) function, we can then apply the screen space alpha cutout texture with our dithering value from before (4/9)
For dithering that's controlled by the particle system, we can send any data we want using custom vertex streams. Here we're sending a custom curve over lifetime to TEXCOORD0.z in our shader (5/9)
We can grab this data in our vertex function again (6/9)
And apply it to our screen space cutout texture as before (7/9)
For the texture itself, most games use a bayer matrix but we prefer blue noise as it looks more natural and less pattern/grid-like (8/9)
And here's some screenshots of the effect. In conclusion, it's a great way to get a stylized fading effect without translucent overdraw, and prevents the particles from obscuring the player camera (we have a lot of ridiculous over the top effects). Thanks for reading! (9/9)
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to Phi Dinh ✈️ GAMESCOM
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!