Download

2nd opinion / help on Frosty shader

Hello all,

I have been working on a couple of dynamic winter shaders and I am having a bit of trouble with my frosty looking one. A friend of mine critted me on it and I have made some changes but still am in need of a 2nd opinion / advice on going in the right direction with it. This is what it looks like at the moment and the shader is below it.

I think it looks pretty good but I am trying to get some bits to sparkle like you would get with frost in certain lighting situations. Has anyone ever come across something that could help suit my needs?

Cheers for any feedback :slight_smile:

https://scontent-b-lhr.xx.fbcdn.net/hphotos-prn1/t31.0-8/10014981_10152062216087986_3225154586177361301_o.jpg

https://scontent-b-lhr.xx.fbcdn.net/hphotos-frc1/t31.0-8/882301_10152062224672986_3344313858793450033_o.jpg

I think it is a great start!

I see you have a constant 0.5 for metallic. If that really was a metallic surface with frost on it, you would want to mask out the metalness (metallicness? metalocalypse?) with the density of the frost. I would also fade between different normalmaps using the frost alpha as well, or maybe just fade the intensity down.

Also, you might want to try having the frost mask accumulate more on the tops of the meshes than the sides. The material function “World_Aligned_Blend” can help you do that. You could use that as the transition phase with the “HeightLerp” function using your frostmask as the height input.

Artistically speaking, you might want to experiment with different styles of frost mask textures on different surfaces. The mask you have there looks kind of like standard cloud noise shapes which could be good for terrain or concrete, but for metal you could experiment with a frost mask that has a bit more of a “crystalline fractal” look, like the frost formed ice crystals on the surface.

Just a bit of criss-cross crystally noise like this picture could go a long way: http://freestocktextures.com/images/small/fst_200afspyi6q.jpg

Hello Ryan,

The above shader is in fact a material function and I am indeed using world aligned blend in the master material :slight_smile: I have changed the MatLayerBlend_Simple function so that when you plug in 2 textures it blends between the normal maps and roughness properly using the world aligned blend w/explicit normals value to do so.

With regards to accumulating on the tops, I have done this for snow as you suggested using the world aligned blend and the snow piles on top quite nicely :slight_smile: but the frost shader is supposed to envelope the entire mesh over time. I experimented quickly with the heightlerp function but could not get the results I was after, or perhaps I was not using it properly? How did you mean use both world aligned blend and the heightlerp to blend between the 2? The customised blend function seems to work quite well but do you think the heightlerp function would serve better?

I will look into some different textures for the frostyness mask. I have attached the master material breakdown below and the customised material blend function. I am currently documenting/tutorialing how I did it all. While the custom blend looks super messy it is described properly in the tutorial :slight_smile:

here is the master material breakdown:

https://scontent-b-lhr.xx.fbcdn.net/hphotos-prn2/t31.0-8/1965515_10152062498707986_5217219943839424748_o.jpg

https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-prn2/t31.0-8/976536_10152062498752986_8440048348961413888_o.jpg

https://scontent-a-lhr.xx.fbcdn.net/hphotos-ash3/t31.0-8/1980125_10152062502287986_2287493102572587444_o.jpg

Ah, thanks for clarifying and please disregard my first suggestion then :slight_smile:

A heightlerp is just a way of modulating a linear blend by a height texture to create a nonlinear blend. Think grass between cobblestones using cobblestone heightmap. But if you are already achieving that to your satisfaction using some other means, I wouldn’t bother messing with it. I see you are accomplishing this by varying the sharpness of the World Aligned Blend using your frost alpha. Neat trick, that should work nicely. The heightlerp method would just be slightly different, and it will only work along the range of the world aligned blend that has a gradient, not the parts clamped to 1. So you would want to use constants for the sharpness in world aligned blend and move the frost alpha texture to the heightlerp height input if you wanted to see how that works.

I mentioned this in another thread, but the next UE4 release will include a map called “Math_Hall” in the content examples that graphs various material functions on a chart, including heightlerp modulated by a sine wave. This should help you visualize these functions better. World Aligned Blend isn’t graphed though because it’s not really easily graphed…

Ahh I will have to make sure I get that update sounds mega useful!

I’ll be sure to post up the documentation when it’s all written up so people can learn from it. I think how it is at the moment is pretty cool, both the frost and snow shader use some simple but effective tricks :slight_smile: