Making the objects infront of the primary hero translucent?

I am trying to figure out what approach would be the best for this scenario:

I have a group of heroes in the middle of eg. a forest. The trees closest to the camera (those between the group and the camera) are blocking the clear sight for the player and I would like to make those trees more or less transparent.

But - as they are single sided polys, like a tree consists of a “pole” that has branches. How would you “fade them out” ?

IF shader is the only solution, what shader or where do I code that?

Eg. I have a defuse with alpha transparent leafs and if I also have to make it half transparent sometimes, doesnt that give some new problems… argh!..

The simple question is:

How do I hide/fadeout the in scene objects that obstructs my view. Its not the calculation of which to hide, but HOW to hide them nicely so they dont “blink” when I move on with the heroes.

You need to have a special shader for all the ‘fading’ things. Use some kind of semi-transparent shader (that you can set the alpha value in code for), and then it’s as simple as drawing raycasts between the player and the camera and fading out anything that is caught in-between.

There’s no simple way around it, I’m afraid. For most things, there shouldn’t be a problem hacking in a simple alpha blend into foliage shaders (since they usually have transparent parts anyway). As long as you check to make sure that the value exists before trying to modify it, you shouldn’t have any problems with the actual fading part (I’m pretty sure that’s the easy bit).