This might be a stupid question, but how do I get distortion to fade on certain areas of a texture in unreal?
The problem I’m having is I can’t seem to figure out how to make something refract “less” because the material is already at 0 opacity. I couldn’t find any resources online other than to use meshes (which would look awful).
This is the normal map for reference. I tried blacking out the “blank” part but that didn’t seem to do anything except mess the material up even more.
you need to flatten your normal map… @eclipse97
If you are using the standard refraction mode, “Refraction” is actually the IOR. So use a value of 1.0 to effectively have no refraction/distortion.
You can change your distortion method in the material properties using “Refraction Mode”, and you might want to use pixel normal offset instead.
Thanks for all the advice. I doubt this is the proper way to do it but I just ended up plugging this into the refraction.
I’m not 100% sure, but I think you are feeding your refraction channel values between 0 and 1 now. and physically there is no refraction index below 1, as 1 describes the refraction of vacuum. I don’t know what unreal does with refraction values below 1, so, maybe it automatically remaps this and it is all working fine. but thought maybe you want to look up this table Refractive index - Wikipedia for some clarification.
You need to understand what an index of refraction is.
The listed refractive index of a medium is defined as the velocity of light through a vacuum divided by the speed of light through a medium. This order is important.
The speed of light through air is close enough to the speed in a vacuum that often people refer to the refractive index being the speed of light through air vs the medium, and it’s a close enough definition for most real time graphics. But understand there’s an inherent assumption here that light is travelling in air into a medium when you’re looking at those lists of refractive indices. When the light passes out of that medium back into air the equation flips. The index of refraction is now calculated as the speed of light through a medium divided by the speed in air!
This means using a single refractive index for something like a glass sphere in a real time rendered object is a funny thing. In reality, the refractive index for glass is somewhere around 1.5 for air to glass, but there are (at least) two refractions; the refraction entering air to glass (ior 1.5), and exiting glass to air (ior 0.67!). More complex objects like glass cups or heavily facetted objects make this even more interesting. For real time rendering you’re usually only simulating a single refraction, so an ior of less than 1.0 may give a closer approximation to the expected visuals than an ior over 1.0.
It also kind of doesn’t matter, since Unreal is just offsetting the screen position by some hand-wavy amount based on the normal and ior, just do what looks good.