I need to write a glsl shader that uses dithering for transperancy.
I also should be able to give a grade of transperancy.
So 0.1 very transperant and 0.9 almost opaque.
But I don't know how I would write it.
I know how to write a 0.5 transperancy dithering shader, but I don't know how to write one which accepts an argument that tells it how transparent it hast to be.
Asked
Active
Viewed 257 times
0

user2741831
- 2,120
- 2
- 22
- 43
-
"*dithering for transperancy*" Why? Is it 1995 or something? Though to be fair, dithering does make some sense on a high-DPI display as a cheap means of OIT. – Nicol Bolas Apr 04 '16 at 16:15
-
deferred shading doesn't allow alpha blending – user2741831 Apr 04 '16 at 17:59
-
Forward rendering (ie: pass-per-light) is no better at alpha blending, since rendering multiple lighting passes doesn't blend effectively. In both cases, blended objects are usually handled as a separate pass, since you have to sort them anyway. Also, that you intend this for deferred shading is important to know for any particular answer. – Nicol Bolas Apr 04 '16 at 18:02
-
yeah but still I wanna experiment with it a little bit, The Problem I'm having is, that almost any algorithm i use results in a pattern in the dithering, and so at some dithiring levels, the pixels are just straight lines instead of checkerboards – user2741831 Apr 04 '16 at 18:27
-
So is your question about how to implement dithering or how to do so in such a way that doesn't "result in a pattern"? You need to improve your question, adding all of these details you've revealed in comments. – Nicol Bolas Apr 04 '16 at 18:59
-
OK, I'll make a new question – user2741831 Apr 04 '16 at 21:00
-
1No, you're supposed to *improve* your question, not make a new one. That's what the "edit" button is for. – Nicol Bolas Apr 04 '16 at 21:30