Fizzle Fade Improved

3 posts Page 1 of 1
Steve_Yorkshire
Posts: 208
Joined: Tue Feb 03, 2015 10:30 pm
 
  by Steve_Yorkshire » 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!

At the bottom of shaders/common/torque.hlsl:

/// 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! :lol:
Steve_Yorkshire
Posts: 208
Joined: Tue Feb 03, 2015 10:30 pm
 
by Steve_Yorkshire » Mon Nov 06, 2017 5:03 pm
Obviously this is dx only (I've not done any messing around with openGL) so if someone else wants to fiddle with shaders/common/gl/torque.glsl feel free to knock yourself out. Having a quick look it has some comments about creating patterns.

/// 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
Duion
Posts: 835
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Mon Nov 06, 2017 8:56 pm
It is not the end of the file for me, are you running an older version?
Better say directly what to replace and not just "at the bottom"

Hm I tried it out and something has changed on the fading, but hard to tell if it is better or not. Would need some direct comparisons.
3 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest