Search Unity

Set shader property by RenderWithShader() oder replacement.

Discussion in 'Shaders' started by Sam55555, Sep 3, 2009.

  1. Sam55555

    Sam55555

    Joined:
    Jun 26, 2009
    Posts:
    17
    Hallo,
    need help.How can i set oder get shader property by rendering with RenderWithShader().I try in OnWillRenderObject() to get material,but get main material and not replacement shader.
    Thanks for antworts.
     
  2. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,540
    The replacement shader will get all the properties from the original material. So if original material had _MainTex texture (for example), it will be set in the replacement shader.

    If you need to have some other values in your replacement shader (some that are not in the original material), best bet is to use global values (Shader.SetGlobalTexture etc.)
     
  3. Sam55555

    Sam55555

    Joined:
    Jun 26, 2009
    Posts:
    17
    Thank you,that is what i searched
     
unityunity