Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualMJP

Posted 01 July 2013 - 03:58 PM

What you basically want is the alpha to be a probability that a pixel is opaque. I would do it like this:

float random = tex2D(g_dissolvemap_sampler, a_texcoord0).r;
if(alpha < random)
    discard;

You can also use alpha-to-coverage, which will basically accomplish the same thing using a tiled screen-space dither pattern instead of a pure random pattern. You can also  encode a set of dither patterns directly into a texture, and then lookup into that texture based on screen position and alpha value.


#1MJP

Posted 01 July 2013 - 01:51 AM

What you basically want is the alpha to be a probability that a pixel is opaque. I would do it like this:

 

float random = tex2D(g_dissolvemap_sampler, a_texcoord0).r;
if(alpha < random)
    discard;

You can also use alpha-to-coverage, will sort basically accomplish the same thing using a tiled screen-space dither pattern instead of a pure random pattern. You can also  encode a set of dither patterns directly into a texture, and then lookup into that texture based on screen position and alpha value.

PARTNERS