Page 1 of 1

Posted: Mon Nov 06, 2017 4:58 pm
I always thought that the stock fizzle fade looked a bit like venetian blinds opening across one plane - so I added another plane!

/// Called from the visibility feature to do screen/// door transparency for fading of objects.void fizzle(float2 vpos, float visibility){   // NOTE: The magic values below are what give us   // the nice even pattern during the fizzle.   //   // These values can be changed to get different   // patterns... some better than others.   //   // Horizontal Blinds - { vpos.x, 0.916, vpos.y, 0 }   // Vertical Lines - { vpos.x, 12.9898, vpos.y, 78.233 }   //   // I'm sure there are many more patterns here to   // discover for different effects.      //yorks old fizzle out   //float2x2 m = { vpos.x, 0.916, vpos.y, 0.350 };   //clip( visibility - frac( determinant( m ) ) );      //yorks new fizzle in    float2x2 m = { vpos.x, 0.916, vpos.y, 0.350 };    float2x2 n = { vpos.x, 0.350, vpos.y, 0.916 };    clip( visibility - frac( determinant( m ) ) );    clip( visibility - frac( determinant( n ) ) );}  #endif // _TORQUE_HLSL_

All this does is make it fizzle on both x and y planes equally. And remember, translucent materials do proper alpha fading without this fizzle effect.
Fizzle on dudes!

/// Called from the visibility feature to do screen/// door transparency for fading of objects.void fizzle(vec2 vpos, float visibility){   // NOTE: The magic values below are what give us    // the nice even pattern during the fizzle.   //   // These values can be changed to get different    // patterns... some better than others.   //   // Horizontal Blinds - { vpos.x, 0.916, vpos.y, 0 }   // Vertical Lines - { vpos.x, 12.9898, vpos.y, 78.233 }   //   // I'm sure there are many more patterns here to    // discover for different effects.      mat2x2 m = mat2x2( vpos.x, vpos.y, 0.916, 0.350 );   if( (visibility - fract( determinant( m ) )) < 0 ) //if(a < 0) discard;      discard;}#endif //TORQUE_PIXEL_SHADER