Search Unity

Uniform material properties in ShadowCaster Pass

Discussion in 'Shaders' started by william_h, Jan 30, 2015.

  1. william_h

    william_h

    Joined:
    Jan 30, 2014
    Posts:
    2
    Is it possible to force unity (via some flag, pragma, or other setting) to keep the uniform material properties updated during the shadow caster pass? My current tests indicate that it doesn't update them consistently.

    Specifically, I'm trying to create a dissolve/disintegrate effect that properly casts shadows, the dissolve being achieved by comparing a material parameter to a noise texture lookup. It works fine for clipping the relevant pixels on the model, but the shadow seems to render with the material property from a random object in the scene depending on camera position. I've tried both using a float material property & the main color alpha with the same results for either one.

    Its possible something else is happening but that's what I've been able to determine so far, hoping someone else has run into this and has a solution (or can tell me I'm wasting my time and there's no way to get a uniform parameter into the shadow caster pass)
     
  2. william_h

    william_h

    Joined:
    Jan 30, 2014
    Posts:
    2
    Just verified my suspicions that its not updating it and using whatever value was last set in the shader - you can "work around" it by instantiating a new copy of the shader for each material, but that proves to be quite slow (not to mention memory-inefficient, and other problems).

    If there's ANY way at all to get unity to update the shader uniforms before the shadowcaster pass please someone let me know.

    This is why full source for the engine would be nice... 1 line in the lighting code would fix it.