Jump to content

Fizzle Fade Improved


Recommended Posts

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:

Link to post
Share on other sites

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
Link to post
Share on other sites

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.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...