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

Question Changing lighting based on scrolling perlin noise

Discussion in 'Scripting' started by puddleglum, Jun 30, 2023.

  1. puddleglum

    puddleglum

    Joined:
    May 11, 2020
    Posts:
    380
    the idea that i have is to change the lighting of a sprite based on scrolling perlin noise, to make it look like clouds are floating past casting a shadow.
    i know i can sort of do this with sprite lights however i would prefer not to make an animation that changes the sprite of that, and make like 100 sprites with scrolling perlin noise,
    if there is a way i can mathematically have perlin noise change the light level of a sprite then that would be great but i really dont know how. ik i can render Perlin noise to a quad probably but how would i code that to effect lights

    PS: its the same effect as rainworlds ambient lighting

    you can see some areas are lit orange and this scrolls ingame,
     
  2. FlashMuller

    FlashMuller

    Joined:
    Sep 25, 2013
    Posts:
    449
    My rough idea would be to use Shader Graph to have a procdural noise generator (Procedural Nodes | Shader Graph | 6.9.2 (unity3d.com)) and have the lighting effect multiplied by the current Perlin-Noise position and the brightness reduced by the amount. So basically replace your default shader with a shader that has clouds integrated.
     
    puddleglum likes this.
  3. KillDashNine

    KillDashNine

    Joined:
    Apr 19, 2020
    Posts:
    451
    How about just using cloud textures and using some additive shader that has a darkening effect? Then animate these to float past your view.
     
    puddleglum likes this.
  4. puddleglum

    puddleglum

    Joined:
    May 11, 2020
    Posts:
    380
    oh good idea