Silverlight 2.5D RPG Game skills and special effect processing: (7) animation close-up

Source: Internet
Author: User

SilverlightInHLSLIt is not only applicable to scenes and animation rendering, but also for players in the game, we can use it to make animated close-up. For example, switching animations such as fade-in and fade-out, distortion, and phantom rendering during role transmission, as wellDebuffAnd the irregular shape when weak. When appropriate, adding animated close-up for the role makes the game more exquisite and gorgeous. When the player's body and body are happy, perhaps it is these magical special effects that are quietly falling behind the scenes with fascinating fragrance.

RememberShazzam? This powerful tool is still indispensable for close-up. Taking the role's transfer close-up "Phantom drop" as an example, the correspondingShazzamThe ready-made effect name in is:DirectionalblurLet's take a look at it.HLSLCode:

Float Angle: Register (C0 );
Float Bluramount: Register (C1 );
Sampler2d texture1sampler: Register (S0 );

Float4 main (float2 UV: texcoord): Color
{
Float4 C =   0 ;
Float Rad = Angle *   0.0174533f ;
Float Xoffset = Cos (RAD );
Float Yoffset = Sin (RAD );
For ( Int I = 0 ; I < 16 ; I ++ )
{
UV. x = UV. x - Bluramount * Xoffset;
UV. Y = UV. Y - Bluramount * Yoffset;
C + = Tex2d (texture1sampler, UV );
}
C /=   16 ;
Return C;
}

Less than 10 lines1kbAccording5thSectionAfter configuring the method to the game project, we will passStoryboardCreateDirectionalblurThe parameter isBluramountAnimation implementation360Close-up of phantom excessive animation from any angle:

Directionalblur =   New Directionalblur () {Angle =   90 };
Entity. Effect = Directionalblur;
Storyboard blurstoryboard =   New Storyboard ();
Doubleanimation =   New Doubleanimation (){
From =   - 0.25 ,
To =   0 ,
Duration =   New Duration (timespan. frommilliseconds ( 600 )),
};
Storyboard. settarget (doubleanimation, directionalblur );
Storyboard. settargetproperty (doubleanimation, New Propertypath ( " Bluramount " ));
Blurstoryboard. Children. Add (doubleanimation );
Eventhandler Handler =   Null ;
Blurstoryboard. Completed + = Handler = (S1, E1) => {
Storyboard sb = S1 As Storyboard;
SB. Stop ();
SB. Completed -= Handler;
Entity. Effect =   Null ;
};
Blurstoryboard. Begin ();


In some scenarios, we usually use "photo matching" to highlight the grand appearance of players"(Growableappssondisk)Animation close-up: the shadows of countless roles are gathered from all directions, just as the regression of soul and power:

In some cases, a role shuttles from one space to another. The illusory feeling is that the body is decomposed into particles and eventually merged from the bottom to the top. At this time, it is often used as a "new student"(Circlereveal)Animation close-up describes such a life-and-death experience:

In addition, slice close-up similar to Louver blinds and fluctuating twist close-up can also play a icing on the cake when expressing specific Magic effects:

 

So far, this seriesDemoAlready integrated10Several refined and practicalHLSLThe rendering effect, which is stored separately inEffectsIs easy to use. Whether it is enterprise applications or game development, whether it is used for form rendering, or for scenes, animations, role animation close-up are all easy to use:

Of course, from the heart of hope moreSilverlightDevelopers can integrateHLSLTo implement and share more cool animation effects.SilverlightIn the future, the three ends will lay the foundation. Not far away,Silverlight 5After the release, game development will be easy.SilverlightThe front will be worthless. I always believe that the pursuit of perfection will surely shine,Long Kong Li!

To download the source code of this Section, go to the directory.

Online Demo address:Http://cangod.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.