Material tricks








When starting with unreal, I remember being mad about not being able to access the light information when creating a material. It took a little to get confortable with some type of materials like iridescence, cloths or glass. The good news is that 90% of the time you can achieve the result you want without having to code a new light model or doing some crazy stuff.

*All the textures I use in this post are from the engine content (You can enable it in any content browser ->ViewOptions>ShowEngineContent)


Knowing the fresnel


The first resource needed for this kind of materials its the fresnel. In shader development the fresnel is a value that represent the relationship between the view vector and the surface normal.

This means that we will get a value if the surface is perpendicular to the camera or other if its parallel. The fresnel look like a "border light", or like a light that comes directly from the camera itself.

Default fresnel node
Dot product fresnel


There is a fresnel node, but you can get the fresnel manually with the dot product of the camera vector and the pixel normal. Using the dot method will give a result of 1 if the normal is facing the camera, 0 if is facing perpendicular and -1 if is facing in the same direction as the camera.


Cloth like


You can use the fresnel to increase a little bit the brightness in the borders of the surface to get a cloth effect. This is very usefull with materials like moss, where there is a lot of small structures that disperse the light.



 You can play around giving texture to the fresnel or automatically generate a darker or lighter color from an input. Unreal have a function for this cloth effect, its called FuzzyShading ( it takes a base color and calculate a brighter and darker color variations to apply with the fresnel).


Iridescence


In this case the best result is to combine the fresnel variation with a texture. A hue shift comes pretty handy for cases like this, well take the fresnel variation and shift the hue of a color noise texture, this give us nice and view angle changing colors, prefect for iridescence!


Metal, unlit iridescence and a beetle like material.



Cool iridescence!






Frosted glass


Another weird material is a frosted glass. This basically comes down to apply a blur filter to the scene texture and use it as emissive color. Fortunately unreal already comes with a SpiralBlur-SceneTexture node that does exactly that : ) . You can mask the blur to get a more irregular result.




Now, why not mix this things with a soap bubble material?



Experiment and have fun with the shaders!


Comments