Search Unity

Visibility bubble - Titan Quest-like

Discussion in 'Shaders' started by Poupi, Apr 2, 2012.

  1. Poupi

    Poupi

    Joined:
    Jan 11, 2012
    Posts:
    111
    Hi there !

    I'm wondering how to achieve this kind of effect :

    http://www.youtube.com/watch?v=x_qOoVsc38s&feature=player_detailpage#t=37s



    (sorry for the pour quality)

    I've tried to render the foreground ( here the entrance of the cave) with an another camera, and blend the result with the rest of the image with an alpha texture, but i'm a beginner in this kind of effects and i don't know if it's the right way.


    Thank you in advance for your answers.
     
  2. Owen

    Owen

    Joined:
    Apr 20, 2011
    Posts:
    79
    You have it mostly right, this kind of effect probably requires you to render the scene twice if you want things like dynamic shadows to work. Have your second camera draw into a separate render texture and then have the main camera composite that back on top of the scene. The simplest way would be to make a post processing effect that simply draws the second render texture with an alpha mask.

    If you don't need shadows casting on the rocks then you could probably get away with putting a shader on the rocks that alpha blends using a screen space mask. The surface shader example section of the documentation shows how to sample textures in screen space, just set the alpha to the mask texture value.
     
    Last edited: Apr 3, 2012
  3. Poupi

    Poupi

    Joined:
    Jan 11, 2012
    Posts:
    111
    Ty Owen, I used a surface shader and it works very well :) .

     
  4. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    506
    Would you mind posting or providing some information on the surface shader you used? I'm trying to do this right now and I have both cameras setup and all that, but I don't know anything about what shaders to use as I know very little about shaders. Any help would be greatly appreciated.