Search Unity

Convey Shader texture to Light Cookie

Discussion in 'Shaders' started by caoyuxi, Feb 21, 2018.

  1. caoyuxi

    caoyuxi

    Joined:
    Jul 9, 2015
    Posts:
    10
    Hey guys just find out a interesting question where i couldn't find answer anywhere.

    i was trying to pull a realtime shader graphic like perlin-noise realtime animation and use it as light cookie and cookie for volumetric light render (which you can find here). so i could have a dynamic light cookie constantly shapeshifting itself, like this one in real life .
     
  2. caoyuxi

    caoyuxi

    Joined:
    Jul 9, 2015
    Posts:
    10
    Anyone has any idea how to do that in unity?
    Only find this one in form which is playback a sequence of images.
     
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,336
    Light cookies only use the alpha channel of the texture assigned. You should be able to assign a render texture to the light, and then have your shader write exclusively to the alpha color.

    A custom render texture should work here.
    https://docs.unity3d.com/Manual/CustomRenderTextures.html