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

Resolved How to create attached animated shader in Shader Graph

Discussion in 'Shader Graph' started by jGate99, Oct 4, 2023 at 1:41 PM.

  1. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,836
    Hi there,

    Just want to if following artwork can be generated procedurally with shadergraph? If so what'd be the steps ?

    Thanks

    upload_2023-10-4_13-54-7.png
     
  2. FredMoreau

    FredMoreau

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    96
    Hi @jGate99,

    You can do something like this.

    Screenshot 2023-10-04 at 3.14.16 PM.png

    Please share details about the use case if you can.
    Cheers
     
    jGate99 likes this.
  3. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,836
    Sir you are amazing,
    Can I you please also make it rotate like following video
    https://we.tl/t-kAkEbIDov3

    Usecase is to use it as a background for a game, My assumption is that a shader will perform better than an image, is that right?
     
  4. FredMoreau

    FredMoreau

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    96
    While there's a node to rotate UVs, in this case you may simply add to (or subtract from) the Y component of the Polar Coordinates to make the result rotate.
    I also added the ability to position the center.

    Screenshot 2023-10-04 at 5.14.20 PM.png

    I'm not sure about this, but at high resolution, it would use less memory than an Image.

    @BenCloward what's your opinion on performance here?
     
    adamgolden and jGate99 like this.
  5. BenCloward

    BenCloward

    Unity Technologies

    Joined:
    Jul 15, 2021
    Posts:
    89
    It's very hard to predict whether a texture sample or procedural generation will be cheaper. The answer is different depending on the platform and on the context (what other things are happening in the scene). The best way to know is to test both on the target hardware and measure the performance. My guess is that in this case, the procedural approach will be slightly cheaper, but I can't guarantee that.

    This procedural method that Fred gave you has several advantages over a texture sample. It will maintain sharpness and clarity regardless of the screen resolution. It doesn't use any texture memory. And it's very configurable - easy to change without having to jump out to image editing software and re-import assets.
     
    FredMoreau, adamgolden and jGate99 like this.
  6. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,836
    @BenCloward @FredMoreau
    Yes, having crisp background is why I preferred procedural approach
    Thank you very much, you guys are amazing