Home Unreal Engine

Possible to "fake" refraction roughness/glossiness in UE4?

polycounter lvl 3
Offline / Send Message
fhurtubise polycounter lvl 3
I'm a shader noob, so I'm making this thread asking for guidance. I'm not super well-versed in technical terms either, so please forgive me if I get anything wrong.

One of the biggest features missing in basic UE4 glass shaders to get believable glass is some kind of refraction glossiness. You can get frosted glass by using some simple effects like a Spiral Blur node, but the blur will be even across the surface. This does not reproduce a property of real glass where, when dirty, any light hotspots seen through the glass will get spread out, just like a specular reflection.

I'm not sure if this is derived from refractive or reflective properties of materials (thus my apology if I get the terms wrong), but as far as I can observe, this effect works the exact same way as material roughness modifies reflections and specular highlights, except rather than spreading out the reflections on the surface (which are driven by cubemaps, dynamic lights, SSR, etc.), it spreads out what can be observed behind the transparent material.

Here are some pictures that illustrate the effect:



Would there be a way to obtain this in Unreal?

Replies

  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Sure. Check out the "opaque translucent" technique on google.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    The second way is to sample the scene texture a few times with some small offsets, to blur it based on the roughness map. This would be higher quality, but more expensive.
  • Calvinatorr
    Offline / Send Message
    Calvinatorr polycounter lvl 4
    Not to plug my own stuff but I developed my own glass shader for this same purpose - https://www.artstation.com/artwork/BmkZ14
    I have improved and fixed some stuff since posting that so I'll have to get round to updating it. Basically I have written my own forward shader for this and passed in the light properties myself (just for a directional light at the moment, but you could easily implement your own, albeit limited number of lights).

    You could intensify the scene behind too to a certain point as HDR values are compressed down in the Scene Color buffer so you need to uncompress them but they are limited to about 20 luminosity I believe?

    Any questions please feel free to throw them my way :smile:
Sign In or Register to comment.