UE5 Kuwahara Post Process (Dab Paint Style) HLSL
Kuwahara Scene Render 01

Kuwahara Scene Render 01

Kuwahara Scene Render 02

Kuwahara Scene Render 02

Kuwahara Scene Render 03

Kuwahara Scene Render 03

Kuwahara Test Scene Render

Kuwahara Test Scene Render

Material Set up

Material Set up

Material Instance. A size of 2 will look nice in the editor but you'll need <4 when taking screenshots.

Material Instance. A size of 2 will look nice in the editor but you'll need <4 when taking screenshots.

Material Expression custom node (Copy and paste from the description)

Material Expression custom node (Copy and paste from the description)

UE5 Kuwahara Post Process (Dab Paint Style) HLSL

Using the Material Expression custom node, copy and paste this code:

int tIndex = 14;
UV = ViewportUVToSceneTextureUV(UV,14);
int x;
int z;
float SumR = 1e+2;
float SumTotal;
float normalizedRatio = float((Size + 1) * (Size + 1));
float2 texelScale = float2(1.0/ScreenResolution.y,1.0/ScreenResolution.x);
float3 singleA = float3(0.0,0.0,0.0);
float3 singleB = singleA;
float3 singleC = singleA;
float3 singleD = singleA;
float3 DoubleA = singleA;
float3 DoubleB = singleA;
float3 DoubleC = singleA;
float3 DoubleD = singleA;
float3 sceneCol;
float4 sceneText = SceneTextureLookup(UV.xy,tIndex,false);
float4 Color;
for (z = -Size; z <= 0; ++z) {
for (x = -Size; x <= 0; ++x) {
sceneCol = SceneTextureLookup(UV + float2(x,z) * texelScale,tIndex,false).rgb;
singleA += sceneCol;
DoubleA += sceneCol * sceneCol;
}
}
for (z = -Size; z <= 0; ++z) {
for (x = 0; x <= Size; ++x) {
sceneCol = SceneTextureLookup(UV + float2(x,z) * texelScale,tIndex,false).rgb;
singleB += sceneCol;
DoubleB += sceneCol * sceneCol;
}
}
for (z = 0; z <= Size; ++z) {
for (x = 0; x <= Size; ++x) {
sceneCol = SceneTextureLookup(UV + float2(x,z) * texelScale,tIndex,false).rgb;
singleC += sceneCol;
DoubleC += sceneCol * sceneCol;
}
}
for (z = 0; z <= Size; ++z) {
for (x = -Size; x <= 0; ++x) {
sceneCol = SceneTextureLookup(UV + float2(x,z) * texelScale,tIndex,false).rgb;
singleD += sceneCol;
DoubleD += sceneCol * sceneCol;
}
}
singleA /= normalizedRatio;
singleB /= normalizedRatio;
singleC /= normalizedRatio;
singleD /= normalizedRatio;
DoubleA = abs(DoubleA / normalizedRatio - singleA * singleA);
DoubleB = abs(DoubleB / normalizedRatio - singleB * singleB);
DoubleC = abs(DoubleC / normalizedRatio - singleC * singleC);
DoubleD = abs(DoubleD / normalizedRatio - singleD * singleD);
SumTotal = DoubleA.r + DoubleA.g + DoubleA.b;
if (SumTotal < SumR) {
SumR = SumTotal;
Color = float4(singleA, sceneText.a);
}
SumTotal = DoubleB.r + DoubleB.g + DoubleB.b;
if (SumTotal < SumR) {
SumR = SumTotal;
Color = float4(singleB, sceneText.a);
}
SumTotal = DoubleC.r + DoubleC.g + DoubleC.b;
if (SumTotal < SumR) {
SumR = SumTotal;
Color = float4(singleC, sceneText.a);
}
SumTotal = DoubleD.r + DoubleD.g + DoubleD.b;
if (SumTotal < SumR) {
SumR = SumTotal;
Color = float4(singleD, sceneText.a);
}
return Color;

More artwork