Search Unity

"Boost" effect

Discussion in 'Shaders' started by realworld666, Feb 25, 2015.

Thread Status:
Not open for further replies.
  1. realworld666

    realworld666

    Joined:
    Nov 2, 2012
    Posts:
    24
    Can anyone recommend a good way to write a shader or algorithm that would give the boost blur effect you often see in racing games like Burnout when using nitrous. (notice the blurring around the edges of the screen)
    I'm also interested in a good way to do a "warp speed" like effect where stars stretch away from the camera as you fly into them.
     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    This effect is often referred to as Radial Blur. Can't really recommend a ready-to-use solution, but here are a few links that should help:

    Radial Blur implementation in non-Unity:
    http://www.gamerendering.com/2008/12/20/radial-blur-filter/

    Radial Blur implementation in Unity:
    http://forum.unity3d.com/threads/radial-blur.31970/

    And here are some hints how to make a racing game feel more fast:
    http://blogs.msdn.com/b/shawnhar/archive/2007/09/05/vrrroom-whoosh.aspx
     
  3. realworld666

    realworld666

    Joined:
    Nov 2, 2012
    Posts:
    24
  4. GameManiacs

    GameManiacs

    Joined:
    Sep 20, 2020
    Posts:
    5
    I made an easy and quick boost script that works with fill amount of the nitrous meter.

    Code (CSharp):
    1.     using UnityEngine.UI;
    2.    
    3.     private float nitrousForce;
    4.     public Image NitrousBar;
    5.    
    6.     void NitrousForce(bool n)
    7.         {
    8.             rb.AddForce(transform.forward * nitrousForce, ForceMode.Impulse);
    9.         }
    10.    
    11.         void Refill(bool r)
    12.         {
    13.             NitrousBar.fillAmount += .1f * Time.deltaTime;
    14.         }
    15.         void Nitrous_Activate()
    16.         {
    17.             if (Input.GetButton("Fire1"))
    18.             {
    19.                 if (NitrousBar.fillAmount >= .1f)
    20.                 {
    21.                     NitrousForce(true);
    22.                     nitrousForce = 50;
    23.                 }
    24.    
    25.                 if (NitrousBar.fillAmount == 0f)
    26.                 {
    27.                     NitrousForce(false);
    28.                     Refill(true);
    29.                     nitrousForce = 0;
    30.                 }
    31.             }
    32.    
    33.             if (NitrousBar.fillAmount >= 0)
    34.             {
    35.                 Refill(true);
    36.             }
    37.    
    38.             if (NitrousBar.fillAmount == 1)
    39.             {
    40.                 Refill(false);
    41.             }
    42.    
    43.             if (NitrousBar.fillAmount <= 0f)
    44.             {
    45.                 NitrousForce(false);
    46.                 Refill(true);
    47.             }
    48.    
    49.             if(NitrousBar.fillAmount <.1f)
    50.             {
    51.                 nitrousForce = 0;
    52.                 NitrousForce(false);
    53.             }
    54.    
    55.             if (Input.GetButton("Fire1"))
    56.             {
    57.                NitrousBar.fillAmount -= 0.04f;
    58.             }
    59.         }
    60.    
    61.     private void FixedUpdate()
    62.     {
    63.         Nitrous_Activate();
    64.     }
    I hope this works for anyone trying to make a simple speed boost effect.
     
  5. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,458
    Not only are you necroing a 7 year old post but you're replying to a post about shaders with a script that isn't related.

    Please take the time to look at the dates of posts before replying.

    Thanks.
     
Thread Status:
Not open for further replies.