Transparent fading with nodes


I would like to ask if it is possible to let the edges of an object fade away to transparency with the node editor.

In my example file, I want the edges of the water to fade away. Unfortunately, I have no idea how to do it and if it is even possible.

Would appreciate any help.

Thank you!

Greetings André


help-water.blend (525 KB)

You need to feed some input into the transparency. For this I tend to use distance from camera using the cameraData node.
The other good option in this case is vertex colour, and have a few more polies in the mesh.
Either way add it in by feeding it into the “alpha” channel of the output node.

Hehe, that was once my blend wasn’t it? Use it however you like.

Hehe, yes it is yours :slight_smile:
It was taken from the file where the player can move infinitely and it seems that the water is infinite too, but in reality it’s the plane which is always tracking the player. That was a great solution to save ressources!

Thanks for the advices, I will try to come to a solution.

I’ve been messing around in order to achieve it with camera input over a vector and then to the alpha output.
Unfortunately I don’t have enough experience with nodes and I cant seem to solve it on my own.

I managed to achieve a fading effect but it fades out in the wrong direction.

When I look top view the fading shouldn’t be visible at all. But in my file it is fully visible.
When I look to the horizon line the edges of the plane shouldn’t be visible due to the transparency fading. But that’s not the case in my file.

Also is there a way to control the fading effect?

Furthermore the fading effect is only on one side of the plane… I would need it to be an all sides of the plane. Is that possible?

Here are my latest results:


help-water.blend (525 KB)

Is this what you’re looking for?

help-water.blend (527 KB)

I extruded the waterplane to give it a border, then painted the vertexes on the outside of the border black.

That vertexcolor I inserted in the nodes (replacing your attempts) and it’s vertex-color-output is directly connected to the output-alpha.

It won’t work in Blender version 2.78 though. Up to 2.77 you’re fine, and I hope it will soon work in 2.78.

Beeehhh… I just noticed that it works in the viewport, but not in the player.
…which is due to backface culling. Turn OFF backface culling on the material, and it works fine. Or play around with flipping normals.

Try this:

The water will fade out at 30 units distance, and the rate of fadeout is determined by the value in the “multiply” box. Lower values are smoother.

Note: The camera vector contains direction information, which we don’t need to use here.

That’s perfect, exactly what I need! Both of the solutions are great.

I played around with so many different nodes but I would have never come up with that solution.

Thanks a lot.