Here I will be adding shader examples and comments,
ranging from beginner to more complex.
I am still in the process of documenting and more will be uploaded as I go.
Requests are welcome and I will try and add them.
Simple shader & control
Detail normal maps
Position based variation
Camera distance blend
Blending with terrain
Foliage variation masks
More examples bla bla bla
Simple shader & control
In this example, I am using the diffuse output to create a generic specular and roughness value.
If no specular or roughness texture is created in the texture process, that is unique and serves a purpose,
most artists tend to desaturate the diffuse texture and alter the brightness and contrast. The changes made mostly have little impact, but the memory used by this texture becomes noticable.
For my project for instance, I am making use of 8k textures, where each diffuse texture is 44Mb and the normal 87Mb. When it reaches this large amount there is no place for silly desaturation that can ruin the memory pool.
So when building your textures, always ask yourself what size the texture will be, do I need a unique texture for this or can I get away with something that uses variations and noise?
It is a good practice to understand size and memory, the common 2k texture for instance is only 2731kb, 2,5Mb, not that much, but at the end of a project where you have hundreds or even thousands of textures, every bit matters.
The values here can be added with the shortcut "1", right mouse to convert to Parameter or directly with "s", "m" to add a Multiply node to the shader and connect everything.
For the 1-x node (hotkey "o") is used to invert the values, as 0, black, is shiny and 1, white, is dull.
I use 0.3 a lot for my diffuse, 0.2 for specular and 1 for roughness as starting point,
as these values are now parameters you can make real time changes and tweak it to your liking.
In this example, I am desaturating the roughness output to be viewed on the asset through the diffuse channel.
This can be of great help to figure out what results you are getting, maybe not with a simple shader but with tiling noise and variations added to it
Specular 0 and roughness 1 makes sure the material is dull and easier to view.
Lerp (linear interpolation)
In this example, Red can blended with Blue by using a Lerp.
The value 0 means that A shows 100%. Set to 1, B would be at 100%.
Easy to remember is 0 and A are the starting point and show first.
Either you say B comes after A. So a value of 0.25 would mean that the layer Blue is blended 25% on top of Red.
Or, texture A with a value of 0 means no see trough or transparency, than a value of 0.1 would mean that it shows the other texture by 10%.
Detail Normal maps
Merging or using multiple normal maps is one of those tricks that is hard to figure out, and can lead to loss of detail or values if not done correctly.
Previously you needed to set up a whole bunch of nodes by hand, which can now be done with a single node "BlendAngleCorrectedNormals".
If you double click the node, you get a closer look at the nodes used to create the function.
I keep the most important texture in the "BaseNormal" and the tiling texture in "AdditionalNormal". TexCoord"0", can be added with the hotkey "u", and coord 0 is channel 0, your default UV layout.
By multiplying the UV coordinates you can scale it, making the texture repeat multiple times on the surface, which is great for a smaller noise or detail normal map.
By using a variation mask you can blend between two different setups of the same material.
Every material we recreate has some form of variation in it and so it is important to have this in your shader.
By creating a contrast rich tiling, greyscale texture with noise, dirt or perhaps paint splashes, you can very easily make real time variation.
Remember that greyscale textures can be saved in any of the RGB channels, when creating noise or variation masks, make sure to utilize all the channels
and save memory that way. Put the noise in Red for instance, dirt in green and paint in blue and have them all interact seperate from eachother.
Here you could use 3 different sized noise patterns to create a single mask, by controlling the tiling seperately.
Do keep in mind that multiplying values on top of eachother can get contrasty and bad results, try the debug grey approach and plug it into the diffuse to really see what the mask is doing.
You can also make multiple changes, for instance let one of the channels control the color of the texture instead of the brightness.
If you want even more variation and control, you can apply the same steps to the variation mask itself and the specular & roughness.
Here is a simple position based variation. It gets a world position, which in turn affects every instance of an asset.
Multipling with 0.01 is a good size, to repeat faster you can try 0.1, or to have a longer gradient 0.005 can be used.
From there is gets every axis, XYZ coordinates that it adds to become a random value. this value can be stretched or shortend by a scale value.
By using the "Frac" node, it removes the every number before the dot. So 10.123, will become 0.123, or 2.4 becomes 0.4.
This is perfect because the Lerp works from 0.0 to 1.0, so we do not go over or under the range needed to blend between our input but instead repeat.
For another example try and open up the "speedtreecolorvariation" node.
Vertex color & ambient occlusion
Couple random blends based on vertex colors. Be creative and use multiple channels for different purposes.
Either blend between different textures or materials, between just a color variation or make sure to use Ambient occlusion.
I store an ambient occlusion bake in every model to be connected to the input and applied slightly to the diffuse material.
Fresnel is a great way to blend or manipulate your shader properties based on view angles and edges.
For some assets you want to add or remove harsh reflections, for instance a leaf can look great with some shiny surface when viewed top down,
but under an angle it can blow out completely. To counter this you could use fresnel and take the values down to an acceptable level.
Many leaves have a slightly brighter or dull, more desaturated look perhaps on the back side, this node allows you to make those tweaks.
Great for foliage, and being able to alter the specular and roughness channels. Try and combine it with a lot of examples above like the fresnel.