Hey guys,
i wanted to share with You a multitexturing material i did for the W3: Blood and Wine expansion.
It started with a simple texture blending idea (three textures blending together):
We've later figured out how to expand it's functionality to be more versatile:
In the end we've used the above textureset in every building in the rich district.
all those buildings share the same 7 textures. (plus 2 trim textures)
more at:
https://www.artstation.com/artwork/keXwncheers!
Replies
Ps.: The link you posted is invalid, there's an extra x at the end
Thank you so much for sharing this!
But can I ask you some questions about this workflow? I'm thinking in a way how to reproduce it in UE4.
From your post I got this:
* One of the channels (e.g. Alpha) is used to define which texture is the base.
* The base texture already is colorized. So you have lots of the same texture with different colors? (Maybe a substance/material instance can be used for this)
* Another channel (e.g. Red) is used to apply the dirt alpha. (Leaving the Green and Blue for other dirt patters)
I'm correct?
Thank you sir, have a great day
*correct
*the textures are neutral and colorized in the shader
*correct
But It's a bit more complicated
ATM UE4 does not support texture arrays but that feature developed and currently under review.
https://github.com/EpicGames/UnrealEngine/pull/2340
You could do it without the array using multiple textures plugged directly into the material. Though depending on how many textures You want to blend the graph could get messy.
I've actually downloaded and built that branch but the support is really basic and not production ready IMO.
Back to the material itself:
The main goal was to create a multilayered material that would work for all buildings in a district. Most of them were build from bright brick and covered with plaster. So the idea was to have a plaster material that when damaged would show the bricks underneath. The only thing that would change between the buildings would be the color of a plaster. (which makes sense since people build from the same material but use different paint color). Later we've realized that if we append more brick textures to the array it can work in reverse. Clean brick that gets dirty and damaged.
We've added the dirt/decal texture to introduce more variation.
Material's input:
VC breakdown:
R - AO
G - texture blending
B - dirt pattern (can be used for other things like decals or paintings)
A - unused
Coloring is done using a color parameter/texture in the material instance.
The composition happens in this order:
This image is done in PS so it's not 100% accurate but the idea is the same:
Blending - GREEN CHANNEL:
The blending is done based on a Green Vertex Color value. First You divide the 0-255 by the maximum amount of textures You want to blend. So say it's 16. You may not use as much but it's just safe to have a number that You won't exceed.
So 256/16 = 16 this gives us 16 ranges with 16 values in each:
0-15 16-31 32-47 48-63 64... etc.
Those values will represent each texture and how much it blends with the next one.
T0 0 - 15
T1 16 - 31
T2 32 - 47
T3 48 - 63
and so on
The blending is done by a Lerp operation:
A:Tn
B:T(n+1)
V: blend balue
0 means full T0
16 full T1
24 half T1 half T2
32 full T2
Vertex color comes in as a 0-1 value, so we multiply it by the max texture number 16 (actually by 15.9999. If You'd multiply by 16 at VCG value of 1 it would try to access T16 and since we start from T0 we only have T15).
We need an index 0-15 of a base texture and a 0-1 lerp value. You can get it by using floor function.
Lets say we have a VCG value of 0.15625 (in 0-255 it's 40).
Index = floor (VCG *16) = floor(2.5) = 2
Blend Value = VCG *16 - Index = 2.5 - 2 = 0.5
So Lerp takes T2 and T3 and blends them by a value of 0.5
Later that value is altered by T3's blending mask.
Coloring:
Colorization is done in the shader. It would be a waste to have multiple textures with different colors. You colorize the textures You want in the shader by a simple multiply operation.texture * BLUE = texture
For example You colorize the plaster textures in BLUE. Of course You want the brick texture to stay neutral. So You colorize textures based on a range.
For example range 0-2 will colorize first three textures. To get more variation You can also set it to 0-1.5 and it will colorize first two by 100% and the third one by 50%.
Dirt/Decal - BLUE CHANNEL
Works similar to coloring, but instead of multiplying You simply Lerp the decal texture with base textures.Sheesh this ended up being longer than i thought
Hope it clarifies a bit.
Cheers
<Side note>
I didn't even knew that texture array was a thing, I thought that it was all done in a 'messy' material; Good to know that Epic will implement it in the future.