Is there a better way to "feather" the edges of a mesh?

unity
shaders

#1

So, this is what I have so far:


My goal is to create a sort of orb created from wind. Sort of like like Aang’s air scooter from Avatar: The Last Airbender. I don’t like the sharp edge of the sphere and I was wondering if there is a good way to feather it?

I am working from a shader that I created in Shader Forge. I am incorporating fresnels and it’s given me some success but it’s not quite what I want.

I’ve also tried a bit of vertex offset, but it looked terrible. I am fairly new to working with shaders, so maybe it would work, but at the moment I’m lacking the experience to know how to make it work.

Is there a better way to accomplish this feathering? Or some way to break up the edge a bit?


#2

Looks like you’re pretty close to the solution already. Just inverse your inner fresnel results (unreal calls it a OneMinus node). Additionally, you could multiply the noise texture through the inner fresnel before combining with the other fresnel.


#3

Instead of multiplying those two fresnel values try taking the minimum of the two. You might have to readjust the exponent of each to get the right looking result, but with your current setup it should give you black on the “inside”, a white ring, and black out the outside.


#4

Things to try.
Scale the power of your fresnel between a couple values using another texture.
Scale the offset of the fresnel with another texture.
Flat out multiply some noise against your opacity, but add back a portion of it.


#5

I think your close actually. As William suggested try power; is that better for your falloff? (maybe 2 or 3 instead of 4)

just mult in your other texture with the other falloff and it should be fine


#6

Thanks for all of your help! I really appreciate it! I tried out all your suggestions and I think I about have it:

And for those who are curious:


#7

It occurs to me that you might want to create a layering effect with this so that the back part of the sphere is broader and darker, and the front part is thinner and lighter. Your sphere is flattening out because everything is the same value no matter what direction it’s going or what distance it is. I think your challenge here is to create foreground/background relationships.

Are you actually using a sphere in the final effect or will it be a sprite?


#8

I can see what you mean. I am planning on using a sphere for the final effect. Do you have any suggestions on how I could improve the foreground/background relationships? Or how I could incorporate the broader/darker back and thinner/lighter front to the sphere? Or would using sprites be a better?


#9

If you can use a sphere, that’s probably ideal. That will allow you to have the sphere look more like it’s surrounding your target, no?
You should be able to use the negative normals to help split the background from the foreground. Making the bkg dimmer and more blurry is probably a good idea.
Remember, warm colors approach, cool colors recede. So an ever so slight saturation might help you. Subtlety!

Also, consider letting the foreground swipes cover the character up just a little to sell the near face of the sphere.


#10

I wound up lerping two colors using a Face Sign node. I wasn’t sure on how to blur the backfaces, so this is what I’ve got so far:


VFX Reel - BrianH, Updated! Looking for some more feedback!
#11

One other option, if you need to make more of a unique fresnel effect is to make a small horizontal gradient texture defining the opacity you want, then take that initial fresnel value and use that as the X coordinate when reading that texture. After that, it’s easy to make a small collection of fresnel gradients that can share this one shader (even all within one texture to save memory).


#12

[quote=“Essaila, post:10, topic:1693”]
blur the backfaces
[/quote]the geometry tab lets you set the cull; what do you mean?


#13

Right, and I set the face culling to double sided. I can use the face sign node to assign a color based on whether the geometry is front facing (facing outward) or back facing (facing inward). @William_Mauritzen suggested making the background (in this case the back faces) of the sphere more blurry, but I’m not sure on how to do that via shader. I’m still very new to making shaders (and working with 3D objects as well), so I apologize if I’m not using terms correctly.


#14

Could you explain this a bit more? Sorry, I’m still super new to shaders and I’m not sure how to apply that!


#15

[quote=“Essaila, post:13, topic:1693”]
double sided
[/quote]yep

would need someone to show how to set that up. essentially the back faces get a cool tint RGB, perhaps //[min (-xR, -xG, +xB),0]


#16

A fresnel LUT! What a good idea, I never thought about this!


#17

I haven’t used Filterforge for a couple years now. I don’t remember how to get the camera reflection or normals. There could be an issue with the back faces thinking that they face the camera and therefore the backface normals are positive as well.


#18

Just be warned that a dot product result is a cosine, so half of a fresnel LUT gets used in the first 15% of the falloff. You can convert to a linear falloff using acos() to get better and more understandable use of the texture, but trig functions are quite expensive and textures are fairly cheap.


#19

Thanks a lot! I’ve been struggled about this problem for making my own material about for a week. Now I solved all about it. Thanks again.


#20

I’m sorry. I was very unclear. If I remember what I was thinking…I thought you could use two sphere. One for normals that face the camera from the outside of the sphere, and one for the inside. Both would be single sided materials. You’ll want to have the edges of the sphere blur out. So as the normal goes to 0. Blend to 0 faster against your fresnel.

The textures used for the inside of the sphere that faces the camera could be blurrier and tinted blue.

I don’t have a strong vision of your environment or character, so it’s hard to tell how well a lot of this will work. But two spheres means twice as much control…but half as performant as one sphere.