Skip to content

Commit 61094d9

Browse files
committed
recompile shaders after cleaning up detail mixing functions
1 parent cbf4d32 commit 61094d9

File tree

5 files changed

+31
-15
lines changed

5 files changed

+31
-15
lines changed

CustomShaders/Surface/TU-Include-Functions.cginc

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ inline fixed3 mix3(fixed3 a, fixed3 b, fixed t)
5555
return a * (1 - t) + b * t;
5656
}
5757

58+
/**
59+
Pre-Normalized detail mixing function for RGB input.
60+
**/
5861
inline fixed3 recolorStandard(fixed3 diffuseSample, fixed3 maskSample, fixed norm, fixed detailMult, fixed3 userColor1, fixed3 userColor2, fixed3 userColor3)
5962
{
6063
fixed mixFactor = getMaskMix(maskSample);
@@ -71,7 +74,7 @@ inline fixed3 recolorStandard(fixed3 diffuseSample, fixed3 maskSample, fixed nor
7174

7275
//extracts a +/- 0 detail value
7376
//will be NAN if normalization value is zero (unmasked pixels)
74-
fixed detail = ((luminance - norm) / norm) * userMix;
77+
fixed detail = (luminance - norm) * userMix;
7578

7679
//user selected coloring, plus details as applied in a renormalized fashion
7780
fixed3 userPlusDetail = (userSelectedColor * detail * detailMult) + userSelectedColor;
@@ -81,15 +84,28 @@ inline fixed3 recolorStandard(fixed3 diffuseSample, fixed3 maskSample, fixed nor
8184
return saturate(userPlusDetail) + baseOutput;
8285
}
8386

87+
/**
88+
Same function as above, but for single-channel inputs
89+
**/
8490
inline fixed recolorStandard(fixed sample1, fixed3 maskSample, fixed norm, fixed detailMult, fixed user1, fixed user2, fixed user3)
8591
{
8692
fixed mixFactor = getMaskMix(maskSample);
93+
fixed userMix = 1 - mixFactor;
94+
95+
//the value to use from the recoloring channels
8796
fixed userSelectedValue = getUserValue(maskSample, user1, user2, user3);
88-
fixed baseOutput = sample1 * mixFactor;
89-
// dt = (1 - 0) * ( 1 )
90-
// upd = (1 / 0) * 1 * 1 + 1
91-
fixed detail = (sample1 - norm) * (1 - mixFactor) * userSelectedValue * detailMult;
92-
fixed userPlusDetail = detail + userSelectedValue;
97+
98+
//the value of the original sample
99+
fixed luminance = sample1;
100+
101+
//output factor of original texture values, used in unmasked or partially masked pixels
102+
fixed baseOutput = mixFactor * sample1;
103+
104+
//detail value of pixel
105+
fixed detail = (luminance - norm) * userMix;
106+
107+
fixed userPlusDetail = (userSelectedValue * detail * detailMult) + userSelectedValue;
108+
93109
return saturate(userPlusDetail) + baseOutput;
94110
}
95111

Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
{
22
"NAME":"TexturesUnlimited",
33
"URL":"http://ksp-avc.cybutek.net/version.php?id=532",
4-
"DOWNLOAD":"https://github.com/shadowmage45/TexturesUnlimited/releases/tag/1.2.3.17",
5-
"CHANGE_LOG_URL":"https://github.com/shadowmage45/TexturesUnlimited/releases/tag/1.2.3.17",
4+
"DOWNLOAD":"https://github.com/shadowmage45/TexturesUnlimited/releases/tag/1.3.4.18",
5+
"CHANGE_LOG_URL":"https://github.com/shadowmage45/TexturesUnlimited/releases/tag/1.3.4.18",
66
"VERSION":
77
{
88
"MAJOR":1,
9-
"MINOR":2,
10-
"PATCH":3,
11-
"BUILD":17
9+
"MINOR":3,
10+
"PATCH":4,
11+
"BUILD":18
1212
},
1313
"KSP_VERSION":
1414
{
1515
"MAJOR":1,
16-
"MINOR":5,
17-
"PATCH":1
16+
"MINOR":6,
17+
"PATCH":0
1818
},
1919
"KSP_VERSION_MIN":
2020
{
2121
"MAJOR":1,
22-
"MINOR":5,
22+
"MINOR":6,
2323
"PATCH":0
2424
},
2525
"KSP_VERSION_MAX":
2626
{
2727
"MAJOR":1,
28-
"MINOR":5,
28+
"MINOR":6,
2929
"PATCH":9
3030
}
3131
}

0 commit comments

Comments
 (0)