GLSL Shader Nodes: Fake Volume/Invisible Edges Setup

Hello,

I’ve been racking my brain trying to figure out how I can use shader nodes to create a, sort of, fade out effect for in-descript characters. By “fade out”, I mean, which ever parts of the model are facing in a different direction from the camera, I want them to have an alpha channel.

So, from the front, full opacity at the center, slowly fading to full transparency at the (no longer) visible edges.

I’ve tried many method for this, including trying a set up for either camera or lamps to effect it, but to no avail.

In short, I need a way to, no matter where the camera is looking, have the mesh display solid in the middle and fade to full alpha at the edges.

Thanks in advance for your help!

I would think something along the lines of shooting a ray and then using the angle and feeding it into the object color, and manipulating the alpha channel.

Otherwise, a technique most games use is billboard or halo tracking to the camera, then when the camera is within a certain distance reduce the alpha of the material (can be done using the camera input node.)

Again I haven’t tried any of these but this is how I would try and go about solving it.

Go to HG1’s realtime cubemap, download the one with fresnel included and try to learn up from fresnel;) I can’t help more, but this should e useful too.

there is a example of node based volumetric mist in resources somewhere as well,

I’ll attempt to try all of these, though I may end up having to go with a different idea in the end.

Thanks for the tips everyone!

With a little bit of simple vector math, a fade out effect that’s dependent on the face angle can indeed be done.

The tricky part is finding the right geometry vector data sockets to use, but it is possible.

Use geometry normal input’s magnitude (average in vector math node) as alpha, though you’ll need to have your model smooth shaded in order to see it “fade”. There’s no way to do this based on inner volume distance, as ray casting geometry isn’t possible in nodes.

Well, that’s exactly what I was looking for. I didn’t assume that I’d get inner volume distance with shader nodes. That’s just silly.