Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Need help with a shader for an energy shield

Discussion in 'Shaders' started by maragunde, May 23, 2024.

  1. maragunde

    maragunde

    Joined:
    Jun 23, 2023
    Posts:
    1
    Hi folks,

    I have been learning a lot about Unity these last days and even though I am a coder and I feel very comfortable with c#, I had no idea about Shaders. I followed a tutorial to make an energy shield with a customer URP Shader using the Shader graph and got it mostly working, except for a few things.

    I would love to get some help on this since I couldn't find much online, and all the videos I found were recorded like 2 years ago and I think some of this might have changed.

    What I would like to achieve is a Shield that is invisible for the player until something hits the shield, then only the part where it was hit (and around it) should be visible for a few seconds.

    I have an energy shield working following this
    . In that tutorial the shield is always shown and when there is a hit, that part gets brigther. So my case its not the same but I think it should be similar. Could you give me some guidance on how to achieve this?

    Also I think there is some kind of problem with the "Sphere mask" when I use it, I follow 2 different tuorials with that node and couldn't make it work in neither, when I compared my node with the ones in the tutorials, my sphere mask is returning only one value (Out 1) and in the tutorials it seems it outputs a Vector3, did this change? any guidance on how can I use it?

    For example in this simple example I couldn't make the sphere mask work
    upload_2024-5-22_20-15-49.png

    As you can see there the preview of the material kind of changes when I set the values but I can't see any change in the sphere itself
     

    Attached Files: