PostFX module

PostFX: Minecraft 26.3 cheat module, full source for every implementation (1 client: Combatant).

1 implementationVISUALS

Clients with this module

Full module source: 1 implementation

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

CombatantVISUALSsrc/main/java/combatant/client/features/module/modules/visuals/PostFX.javaJava · 338 lines · 13.3 KB
SettingspostFxPresetpostFxLutPresetpostFxLutStrengthpostFxToneMappostFxExposurepostFxGammapostFxContrastpostFxSaturationpostFxVibrancepostFxTemperaturepostFxTintpostFxVignetteStrengthpostFxVignetteRadiuspostFxVignetteSoftnesspostFxGrainAmountpostFxGrainSizepostFxSharpenpostFxChromaticpostFxShadowTintpostFxShadowStrengthpostFxMidTintpostFxMidStrengthpostFxHighTintpostFxHighStrength
PostFX.javaJava · Minecraft 26.2 · 338 lines · 13.3 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Combatant Client distribution.
3
 * Copyright (c) 2026 pivosos2007.
4
 *
5
 * Licensed under the GNU General Public License v3.0.
6
 */
7
8
package combatant.client.features.module.modules.visuals;
9
10
import com.mojang.blaze3d.textures.GpuTextureView;
11
import net.minecraft.client.Minecraft;
12
import combatant.client.config.values.ModeValue;
13
import combatant.client.config.values.NumberValue;
14
import combatant.client.config.values.RGBColorValue;
15
import combatant.client.features.module.Module;
16
import combatant.client.features.module.ModuleCategory;
17
import combatant.client.features.module.ModuleInfo;
18
import combatant.client.render.engine.pipeline.CombatantRenderPipelines;
19
import combatant.client.render.engine.postprocess.PostProcessManager;
20
import combatant.client.render.engine.postprocess.PostProcessExecutionContext;
21
import combatant.client.render.engine.postprocess.PostProcessPass;
22
import combatant.client.render.engine.renderer.FullScreenRenderer;
23
import combatant.client.render.engine.uniform.impl.PostFXUniforms;
24
25
//todo Description
26
@ModuleInfo(id = "postfx", displayName = "PostFX", category = ModuleCategory.VISUALS)
27
public class PostFX extends Module implements PostProcessPass {
28
29
    private static final String SETTING_PRESET = "preset";
30
    private static final String SETTING_LUT_PRESET = "lut_preset";
31
    private static final String SETTING_LUT_STRENGTH = "lut_strength";
32
    private static final String SETTING_TONE_MAP = "tone_map";
33
    private static final String SETTING_EXPOSURE = "exposure";
34
    private static final String SETTING_GAMMA = "gamma";
35
    private static final String SETTING_CONTRAST = "contrast";
36
    private static final String SETTING_SATURATION = "saturation";
37
    private static final String SETTING_VIBRANCE = "vibrance";
38
    private static final String SETTING_TEMPERATURE = "temperature";
39
    private static final String SETTING_TINT = "tint";
40
    private static final String SETTING_VIGNETTE_STRENGTH = "vignette_strength";
41
    private static final String SETTING_VIGNETTE_RADIUS = "vignette_radius";
42
    private static final String SETTING_VIGNETTE_SOFTNESS = "vignette_softness";
43
    private static final String SETTING_GRAIN_AMOUNT = "grain_amount";
44
    private static final String SETTING_GRAIN_SIZE = "grain_size";
45
    private static final String SETTING_SHARPEN = "sharpen";
46
    private static final String SETTING_CHROMA = "chromatic";
47
    private static final String SETTING_SHADOW_TINT = "shadow_tint";
48
    private static final String SETTING_SHADOW_STRENGTH = "shadow_strength";
49
    private static final String SETTING_MID_TINT = "mid_tint";
50
    private static final String SETTING_MID_STRENGTH = "mid_strength";
51
    private static final String SETTING_HIGH_TINT = "high_tint";
52
    private static final String SETTING_HIGH_STRENGTH = "high_strength";
53
    private final Minecraft mc = Minecraft.getInstance();
54
55
    private final ModeValue preset =
56
            modeSetting("postFxPreset", SETTING_PRESET, "Vanilla", "Vanilla", "Soft", "Warm", "Cool", "Custom");
57
58
    private final ModeValue lutPreset =
59
            visibleWhen(modeSetting("postFxLutPreset", SETTING_LUT_PRESET, "Identity", "Identity", "Warm", "Cool"), this::isCustomPreset);
60
61
    private final NumberValue<Float> lutStrength =
62
            visibleWhen(num("postFxLutStrength", SETTING_LUT_STRENGTH, 0.15f, 0.0f, 1.0f), this::isCustomPreset);
63
64
    private final ModeValue toneMap =
65
            visibleWhen(modeSetting("postFxToneMap", SETTING_TONE_MAP, "None", "None", "Filmic"), this::isCustomPreset);
66
67
    private final NumberValue<Float> exposure =
68
            visibleWhen(num("postFxExposure", SETTING_EXPOSURE, 0.0f, -1.0f, 1.0f), this::isCustomPreset);
69
    private final NumberValue<Float> gamma =
70
            visibleWhen(num("postFxGamma", SETTING_GAMMA, 1.0f, 0.5f, 2.5f), this::isCustomPreset);
71
    private final NumberValue<Float> contrast =
72
            visibleWhen(num("postFxContrast", SETTING_CONTRAST, 1.0f, 0.0f, 2.0f), this::isCustomPreset);
73
    private final NumberValue<Float> saturation =
74
            visibleWhen(num("postFxSaturation", SETTING_SATURATION, 1.0f, 0.0f, 2.0f), this::isCustomPreset);
75
    private final NumberValue<Float> vibrance =
76
            visibleWhen(num("postFxVibrance", SETTING_VIBRANCE, 1.0f, 0.0f, 2.0f), this::isCustomPreset);
77
    private final NumberValue<Float> temperature =
78
            visibleWhen(num("postFxTemperature", SETTING_TEMPERATURE, 0.0f, -1.0f, 1.0f), this::isCustomPreset);
79
    private final NumberValue<Float> tint =
80
            visibleWhen(num("postFxTint", SETTING_TINT, 0.0f, -1.0f, 1.0f), this::isCustomPreset);
81
82
    private final NumberValue<Float> vignetteStrength =
83
            visibleWhen(num("postFxVignetteStrength", SETTING_VIGNETTE_STRENGTH, 0.08f, 0.0f, 1.0f), this::isCustomPreset);
84
    private final NumberValue<Float> vignetteRadius =
85
            visibleWhen(num("postFxVignetteRadius", SETTING_VIGNETTE_RADIUS, 0.55f, 0.0f, 1.0f), this::isCustomPreset);
86
    private final NumberValue<Float> vignetteSoftness =
87
            visibleWhen(num("postFxVignetteSoftness", SETTING_VIGNETTE_SOFTNESS, 0.35f, 0.01f, 1.0f), this::isCustomPreset);
88
89
    private final NumberValue<Float> grainAmount =
90
            visibleWhen(num("postFxGrainAmount", SETTING_GRAIN_AMOUNT, 0.0f, 0.0f, 0.25f), this::isCustomPreset);
91
    private final NumberValue<Float> grainSize =
92
            visibleWhen(num("postFxGrainSize", SETTING_GRAIN_SIZE, 1.0f, 0.25f, 2.0f), this::isCustomPreset);
93
    private final NumberValue<Float> sharpen =
94
            num("postFxSharpen", SETTING_SHARPEN, 0.05f, -0.5f, 1.0f);
95
    private final NumberValue<Float> chromatic =
96
            num("postFxChromatic", SETTING_CHROMA, 0.0f, 0.0f, 0.5f);
97
98
    private final RGBColorValue shadowTint =
99
            visibleWhen(colorNoAlpha("postFxShadowTint", SETTING_SHADOW_TINT, "#FFFFFF"), this::isCustomPreset);
100
    private final NumberValue<Float> shadowStrength =
101
            visibleWhen(num("postFxShadowStrength", SETTING_SHADOW_STRENGTH, 0.0f, 0.0f, 1.0f), this::isCustomPreset);
102
    private final RGBColorValue midTint =
103
            visibleWhen(colorNoAlpha("postFxMidTint", SETTING_MID_TINT, "#FFFFFF"), this::isCustomPreset);
104
    private final NumberValue<Float> midStrength =
105
            visibleWhen(num("postFxMidStrength", SETTING_MID_STRENGTH, 0.0f, 0.0f, 1.0f), this::isCustomPreset);
106
    private final RGBColorValue highTint =
107
            visibleWhen(colorNoAlpha("postFxHighTint", SETTING_HIGH_TINT, "#FFFFFF"), this::isCustomPreset);
108
    private final NumberValue<Float> highStrength =
109
            visibleWhen(num("postFxHighStrength", SETTING_HIGH_STRENGTH, 0.0f, 0.0f, 1.0f), this::isCustomPreset);
110
111
    private final float[] ubo = new float[PostFXUniforms.FLOAT_COUNT];
112
113
    {
114
        PostProcessManager.register(this);
115
    }
116
117
    @Override
118
    public boolean isActive() {
119
        return isEnabled() && mc != null && mc.player != null && mc.level != null;
120
    }
121
122
    @Override
123
    public int getPriority() {
124
        return 5;
125
    }
126
127
    @Override
128
    public Phase getPhase() {
129
        return Phase.POST_HAND;
130
    }
131
132
    @Override
133
    public boolean render(PostProcessExecutionContext execution) {
134
        if (execution == null) return false;
135
        GpuTextureView src = execution.source();
136
        GpuTextureView dst = execution.destination();
137
        if (!isActive()) return false;
138
        if (src == null || dst == null) return false;
139
140
        FullScreenRenderer.ensureInit();
141
142
        String presetName = preset.get();
143
        boolean isCustom = isCustomPreset(presetName);
144
145
        float lutMode = resolveLutMode(presetName, isCustom);
146
        GpuTextureView lutView = src;
147
148
        int w = mc.getWindow().getWidth();
149
        int h = mc.getWindow().getHeight();
150
        float invW = w > 0 ? 1.0f / w : 0.0f;
151
        float invH = h > 0 ? 1.0f / h : 0.0f;
152
        float time = (System.currentTimeMillis() % 100000L) / 1000.0f;
153
154
        boolean lutAvailable = lutMode > 0.0f;
155
        fillUniforms(invW, invH, time, presetName, isCustom, lutAvailable);
156
        ubo[31] = lutMode;
157
        PostFXUniforms.update(ubo);
158
159
        FullScreenRenderer.begin("Combatant Fullscreen Pass")
160
                .attachment(dst)
161
                .pipeline(CombatantRenderPipelines.POST_FX)
162
                .uniform("PostFX", PostFXUniforms.get())
163
                .sampler("u_Texture", src, PostProcessManager.getSampler())
164
                .sampler("u_Lut", lutView, PostProcessManager.getSampler())
165
                .end();
166
167
        return true;
168
    }
169
170
    private void fillUniforms(float invW, float invH, float time, String presetName, boolean isCustom, boolean lutAvailable) {
171
        if (isCustom) {
172
            ubo[0] = exposure.get();
173
            ubo[1] = gamma.get();
174
            ubo[2] = contrast.get();
175
            ubo[3] = saturation.get();
176
177
            ubo[4] = vibrance.get();
178
            ubo[5] = temperature.get();
179
            ubo[6] = tint.get();
180
            ubo[7] = lutStrength.get();
181
182
            ubo[8] = vignetteStrength.get();
183
            ubo[9] = vignetteRadius.get();
184
            ubo[10] = vignetteSoftness.get();
185
            ubo[11] = chromatic.get();
186
187
            ubo[12] = grainAmount.get();
188
            ubo[13] = grainSize.get();
189
            ubo[14] = sharpen.get();
190
            ubo[15] = "Filmic".equalsIgnoreCase(toneMap.get()) ? 1.0f : 0.0f;
191
192
            fillColor(ubo, 16, shadowTint.getArgb(), shadowStrength.get());
193
            fillColor(ubo, 20, midTint.getArgb(), midStrength.get());
194
            fillColor(ubo, 24, highTint.getArgb(), highStrength.get());
195
        } else {
196
            applyPreset(presetName);
197
        }
198
199
        // Always allow user tuning for these, even on presets.
200
        ubo[11] = chromatic.get();
201
        ubo[14] = sharpen.get();
202
203
        if (!lutAvailable) {
204
            ubo[7] = 0.0f;
205
        }
206
207
        ubo[28] = invW;
208
        ubo[29] = invH;
209
        ubo[30] = time;
210
        ubo[31] = 0.0f;
211
    }
212
213
    private void fillColor(float[] out, int offset, int argb, float strength) {
214
        float r = ((argb >> 16) & 0xFF) / 255.0f;
215
        float g = ((argb >> 8) & 0xFF) / 255.0f;
216
        float b = (argb & 0xFF) / 255.0f;
217
        out[offset] = r;
218
        out[offset + 1] = g;
219
        out[offset + 2] = b;
220
        out[offset + 3] = strength;
221
    }
222
223
    private float resolveLutMode(String presetName, boolean isCustom) {
224
        String pick = isCustom ? lutPreset.get() : presetName;
225
        return switch (pick) {
226
            case "Warm" -> 1.0f;
227
            case "Cool" -> 2.0f;
228
            default -> 0.0f;
229
        };
230
    }
231
232
    private boolean isCustomPreset() {
233
        return isCustomPreset(preset.get());
234
    }
235
236
    private boolean isCustomPreset(String name) {
237
        return "Custom".equalsIgnoreCase(name);
238
    }
239
240
    private void applyPreset(String name) {
241
        String presetName = name == null ? "Vanilla" : name;
242
        switch (presetName) {
243
            case "Soft" -> fillPresetSoft();
244
            case "Warm" -> fillPresetWarm();
245
            case "Cool" -> fillPresetCool();
246
            default -> fillPresetVanilla();
247
        }
248
    }
249
250
    private void fillPresetVanilla() {
251
        ubo[0] = 0.0f;   // exposure
252
        ubo[1] = 1.0f;   // gamma
253
        ubo[2] = 1.0f;   // contrast
254
        ubo[3] = 1.0f;   // saturation
255
        ubo[4] = 1.0f;   // vibrance
256
        ubo[5] = 0.0f;   // temp
257
        ubo[6] = 0.0f;   // tint
258
        ubo[7] = 0.0f;   // lut strength
259
        ubo[8] = 0.08f;  // vignette strength
260
        ubo[9] = 0.55f;  // vignette radius
261
        ubo[10] = 0.35f; // vignette softness
262
        ubo[11] = 0.0f;  // chroma
263
        ubo[12] = 0.0f;  // grain amount
264
        ubo[13] = 1.0f;  // grain size
265
        ubo[14] = 0.05f; // sharpen
266
        ubo[15] = 0.0f;  // tone map none
267
        fillColor(ubo, 16, 0xFFFFFFFF, 0.0f);
268
        fillColor(ubo, 20, 0xFFFFFFFF, 0.0f);
269
        fillColor(ubo, 24, 0xFFFFFFFF, 0.0f);
270
    }
271
272
    private void fillPresetSoft() {
273
        ubo[0] = 0.0f;
274
        ubo[1] = 1.0f;
275
        ubo[2] = 1.0f;
276
        ubo[3] = 1.01f;
277
        ubo[4] = 1.0f;
278
        ubo[5] = 0.0f;
279
        ubo[6] = 0.0f;
280
        ubo[7] = 0.18f;
281
        ubo[8] = 0.08f;
282
        ubo[9] = 0.55f;
283
        ubo[10] = 0.35f;
284
        ubo[11] = 0.01f;
285
        ubo[12] = 0.0f;
286
        ubo[13] = 1.0f;
287
        ubo[14] = 0.05f;
288
        ubo[15] = 0.0f;
289
        fillColor(ubo, 16, 0xFFFFFFFF, 0.0f);
290
        fillColor(ubo, 20, 0xFFFFFFFF, 0.0f);
291
        fillColor(ubo, 24, 0xFFFFFFFF, 0.0f);
292
    }
293
294
    private void fillPresetWarm() {
295
        ubo[0] = 0.0f;
296
        ubo[1] = 1.0f;
297
        ubo[2] = 1.01f;
298
        ubo[3] = 1.02f;
299
        ubo[4] = 1.01f;
300
        ubo[5] = 0.03f;
301
        ubo[6] = 0.01f;
302
        ubo[7] = 0.18f;
303
        ubo[8] = 0.08f;
304
        ubo[9] = 0.55f;
305
        ubo[10] = 0.35f;
306
        ubo[11] = 0.01f;
307
        ubo[12] = 0.0f;
308
        ubo[13] = 1.0f;
309
        ubo[14] = 0.05f;
310
        ubo[15] = 0.0f;
311
        fillColor(ubo, 16, 0xFFFFFFFF, 0.0f);
312
        fillColor(ubo, 20, 0xFFFFFFFF, 0.0f);
313
        fillColor(ubo, 24, 0xFFFFFFFF, 0.0f);
314
    }
315
316
    private void fillPresetCool() {
317
        ubo[0] = 0.0f;
318
        ubo[1] = 1.0f;
319
        ubo[2] = 1.01f;
320
        ubo[3] = 1.0f;
321
        ubo[4] = 1.01f;
322
        ubo[5] = -0.04f;
323
        ubo[6] = 0.0f;
324
        ubo[7] = 0.18f;
325
        ubo[8] = 0.08f;
326
        ubo[9] = 0.55f;
327
        ubo[10] = 0.35f;
328
        ubo[11] = 0.01f;
329
        ubo[12] = 0.0f;
330
        ubo[13] = 1.0f;
331
        ubo[14] = 0.05f;
332
        ubo[15] = 0.0f;
333
        fillColor(ubo, 16, 0xFFFFFFFF, 0.0f);
334
        fillColor(ubo, 20, 0xFFFFFFFF, 0.0f);
335
        fillColor(ubo, 24, 0xFFFFFFFF, 0.0f);
336
    }
337
}
338