I’m trying to figure out how to make a shader that makes an object seem partially translucent, and blurry. I don’t want motion blur, because the object could be sitting still, I just want the edges to sort of “fuzz out” to the background.
Okay, here’s what I’ve come up with so far. Its a modification to the x-ray shader. Instead of fading into/out of a standard color, it fades through a texture assigned to the object. It doesn’t quite work the way I want, though.
I did not try your shader, but a first guess: try changing “Blend One One” to “Blend SrcAlpha OneMinusSrcAlpha”. The X-ray shader uses additive blending (possibly because the author of the effect wanted it that way), whereas I guess you want regular alpha blending.
That had an interesting effect. It makes it fade out to black where before it was transparent. I’ll keep playing around with it (I’m still learning about shader programming), but any more insights that people might have would be very much appreciated.
Its frustrating working with a new language/paradigm…
Anyway, this gives me the fade-to-edges that I was talking about. It’s not ideal (ideally, it would just sample that part of the screen, and do a radial blur…), and it uses a fragment program, but it’s a start.
Does anyone have any insights into how to get this same effect without a fragment program?
Okay, I’m going all the way with a grab texture, and doing a radial blur on what it gets. I know the radial blur algorithm, no problem, but I have an issue. When I compile my shader, I get a “profile does not support for statements” error. What profile does (that unity knows how to compile to)? Or do I have to un-roll the loop myself?
Unity compiles to ARBVP/ARBFP profile (ARB vertex and fragment programs), roughly a shader model 2.0 equivalent of Direct3D world. They don’t support dynamic branching and Cg might not be able to unroll loops with variable number of iterations.
Doing radial blur is probably better done as an image effect, by repeatedly rendering texture onto itself, while scaling/rotating it. Similar like Motion Blur image effect does.
Okay, good to know. Thanks! How, though, do I do an image effect that only applies to the area of the screen that a particular object is on, instead of the whole screen?
Maybe what you actually want is something akin to a fur shader? With changing it so that there’s more intensity around the edges…
Sorry if that is already what you’re trying to do and I’m just confusing you for no good reason. Don’t have time to play with it myself right now, we’re trying to get some release out of the door… :roll:
Dude. How did I not find that thread in all my searching?! This is exactly the sort of thing that I’m looking for (or at least a GREAT starting point for it). Thank you so much! Hopefully when I start to figure out more of this stuff, I can start contributing back.