- Home /
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.
Answer by syclamoth · Jan 02, 2012 at 11:55 PM
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).
Thanks, thats also what I've been trying so far. I'm just not too good with shader language yet.
Your answer
Follow this Question
Related Questions
How to fade a game object with all its children (Sprite Renderer / Image)? 0 Answers
Shader is not displaying alpha correctly 0 Answers
Metallic/Specular map broke fading in build 0 Answers
Shader with both Transparent and Fade as render mode 0 Answers
Transparent/Specular Shader - I want alpha to control spec, not transparency 1 Answer