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

Spotlight to Reveal a Different Background- Need a nudge in the right direction

Discussion in 'Shaders' started by ADethklokGear, Oct 6, 2014.

  1. ADethklokGear

    ADethklokGear

    Joined:
    Oct 6, 2014
    Posts:
    2
    Hello Unity Community,

    I have been playing around with shaders trying to achieve a certain look. I am not a programmer of any kind so jumping into Shaderlab has been...eye ruining; but I am committed.

    Basically what I have at the moment is a shader material with two textures. A spotlight does reveal the bottom texture but the top texture is still very visible. I would love to have the light completely fade out the top texture so the bottom one is clearly seen. I've seen plenty of code that uses blending but I don't think it will work for what I want. I am not asking for someone to write me code but to point me in the right direction. The hardest part with trying to figure this out is not knowing what options are available to search for.

    ** The example file attached is merely for testing. I promise I am not mashing those two styles together.
     

    Attached Files:

  2. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Look into how alphablending works. You're basically trying to alphablend between two textures, based on a light value. You take that value and multiply it by one of the textures, then you multiply the other texture by 1.0 minus the light value, then add those two numbers together.
     
    ADethklokGear likes this.
  3. ADethklokGear

    ADethklokGear

    Joined:
    Oct 6, 2014
    Posts:
    2

    Awesome! Thank you so much for your help. So super appreciated!