Search Unity

Fade from texture 1 to texture 2 for entire level (built ouf of cubes) - how can it be done ?

Discussion in 'General Graphics' started by Acumen, Jun 27, 2015.

  1. Acumen

    Acumen

    Joined:
    Nov 20, 2010
    Posts:
    1,041
    Hello there everybody,

    so we are working on a little game that uses a modular approach in terms of level design.
    A level is built of nothing but 1x1x1unit meshes with 1 self-illuminated material applied.

    Our idea
    What we would like to do is the following. Similar to the game ZigZag we would like to fade between different textures and are wondering what kind of "trick" we would need to pull. We were not sure whether this is something a shader would be capable of or whether it's even easier/more advanced thing to pull of.

    What we would like to have
    So basically we want to be able to fade from texture 1 to texture 2 for the entire level (since it all uses the same base mesh), then fade from texture 2 to texture 4, and so on. The entire level that is seen should be affected.

    This video shows the kind of fade effect we want to achieve:






    Any help or direction / pointers would be greatly appreciated :)
    Thanks a ton
     
  2. IzzySoft

    IzzySoft

    Joined:
    Feb 11, 2013
    Posts:
    376
    Is that a Lighting effect or a Shader trick? :p
     
  3. Acumen

    Acumen

    Joined:
    Nov 20, 2010
    Posts:
    1,041
    I don't know. Keep in mind, we want to do this with actual textures, so the effect on there we could achieve if the mesh would only be colored, but we want to do this with a texture, so the images might be a bit misleading in the first place :)
     
  4. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Voilà, sample package attached (requires Unity 5 and uses DOTween—ah, obviously—for the animation) :)
    Also includes a custom shader (which I found online—can't remember the link).

    CrossfadeTextures_compressed.gif

    EDIT: P.S. if you want to fade the textures throughout the whole level, just replace material with sharedMaterial in the example (but beware, that will change the actual textures even in the project).
     

    Attached Files:

    Last edited: Jun 27, 2015
    codestage and Acumen like this.
  5. Acumen

    Acumen

    Joined:
    Nov 20, 2010
    Posts:
    1,041
    This is superawesome Daniele.
    Akos implemented it and it works like a charm. Can't wait to get the next build in my hands.
    So so so good :D
    Once again you're my saviour !!
     
  6. Zicandar

    Zicandar

    Joined:
    Feb 10, 2014
    Posts:
    388
    If your idea is as simple as the example it might be enough simply having a global color and ignoring textures :) (Or making them greyscale and then adding color).
     
  7. dogfacedesign

    dogfacedesign

    Joined:
    Jan 10, 2016
    Posts:
    70
    Thanks, mate! That's exactly what I needed! Will give this a go tonight and see how it works.

    Cheers.