Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to make meshes blink white, like Metal Slug bosses on hit?

Discussion in 'Editor & General Support' started by leonardozimbres, Jul 26, 2014.

  1. leonardozimbres

    leonardozimbres

    Joined:
    Jul 9, 2012
    Posts:
    29
    Hello!

    I've tried to change the colors32 of the mesh, but it does depends on shader to get working.
    I dont know much about shaders, but I do really need an unlit one, as my game does not use shadows. I've tested all unlit shaders, but got no luck... Some shaders messes up with the mesh, inverting its faces/polys, or messing with the draw order of the mesh polys.

    May someone help me on this one?
     
  2. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    958
    Are you trying to make the whole object flash, or just some part of it? If it's the whole object, you just need an unlit shader that uses additive colour, such as the one I just knocked up and attached.

    You then just set the material's colour to white to make it flash.

    If you want specific parts of it to flash, there are several ways but one of them is indeed using the vertex colours, and you will need an unlit shader that actually renders additive vertex colours. I've knocked one of those up and attached it as well.
     

    Attached Files:

    leonardozimbres likes this.
  3. leonardozimbres

    leonardozimbres

    Joined:
    Jul 9, 2012
    Posts:
    29
    Thanks Alkis, I will try it right now!
     
  4. leonardozimbres

    leonardozimbres

    Joined:
    Jul 9, 2012
    Posts:
    29
    Alkis, may I ask something more? The mesh is 100% white while applying the shader. There would be a way to start this mesh as it's original colors, so I would not need to reset the meshes to non-white by code?
     
  5. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    958
    Yes, the reason it's white is that it applies additive colour and the colour property on the material defaults to white. Add white to any colour and it will saturate to white. To have the original colours just set the colour to black.
     
    leonardozimbres likes this.
  6. leonardozimbres

    leonardozimbres

    Joined:
    Jul 9, 2012
    Posts:
    29
    Alkis, I want to thank you for your help. You saved my game demo!
     
  7. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    958
    No problem, glad I could help!