From reading the UE4 documentation, I found out that material functions are a bunch of nodes packed into one node. I figured out the Math behind how world alignment works by deconstructing and experimenting with the World Aligned Texture node. This node is one example of a material function. It is also widely known as Tri-planar mapping in substance painter.
Material Function for Tri-planar mapping
This gave me the idea to make a block out material which can have grids, scale without texture stretching and change colours the way I want it to. I also wanted to add the functionality of animating the material. I did this by making some modifications to the World Aligned Texture material function.
Modified Material function with comments to help understand which part is doing what.
I found that substracting the WorldPosition from the Object Position will force the material to move along with the object and not have a weird scrolling effect whenever you move the object. The downside of it is that it can add more instructions to the material.
WorldPosition subtracted from the object position - Material moves along with the mesh
WorldPosition not subtracted from the object position - Parallax scrolling effect when moving the mesh (The material appears to remain static, while the mesh moves.)
I also found that adding a Floor node to the mask values of the world aligned texture material function, makes the material transition smoothly when the object is rotated 45 degrees in any direction.
Mask from world aligned texture material function with added floor node multipled by 2 first.
Meshes rotated 45 degrees. The one on the left is rounded up and looks smooth, whereas the one on the right looks very conflicted and tries to blend between X and Y direction.
I masked the faces in the Z direction to a different colour for variation. This is controlled by a switch based on user preference.
Material is masked in Z to add second colour (white.)
2 layers of Grid textures. One is the base layer, which is the big rounded square. The other layer is the hexagon pattern on top of the rounded square. Noise is added for further lighting information
As for the material itself, I made 2 layers to create 2 variations of grid masks. One being larger than the other. I added Noise information to the Metallic, Specular and Roughness properties to allow extra lighting information rather than having a plain blockout material. The effect is very subtle though.
Final Material Setup with the modified World Aligned Texture material functions nodes in multiple areas
Here is the final video showcasing the customisability of the material:
I thought it's about time to start working on creating the environment to showcase the water in the best way possible. It was suggested that I create this really cool Skull Waterfall environment concept art by Andrey Egorov: However, I will be using this concept as my initial inspiration and will be making my own iteration to the environment so it will not look exactly the same as the concept. It takes a bit of time figuring out and creating some of the features for the water shader. While I do this, I can work on creating the environment so I will be working on the water shader in small increments.
Distance Field Foam Vectortoradialvalue, DistanceFieldGradient used for U channel and DistanceToNearestSurface used for V. I thought about how texture coordinates worked and how VectorToRadialValue worked. Both being gradients in R(U) and G(V), I had a theory about creating coordinates based on using Distancetonearestsurface node as G(V) channel and have VectorToRadialValue or Distancefieldgradient node as the R(U) channel. I was initially going to use the DistanceFieldGradient node that I learned about when making the distance field flow map. This is because the node had that Texture coordinate look to it but it adds a lot to the shader instructions so I went with VectorToRadialValue node. I extracted and used maths for the R channel from VectorToRadialValue and it produced the coordinates I wanted. I then added this coordinate to the noise based foam I made earlier using Alex Vinogradov's approach. I later decided to add Distancefieldgradient node just to see if it pro
Is there anywhere to download this or buy it?
ReplyDelete