-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMain.cs
570 lines (364 loc) · 30.6 KB
/
Main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
using Harmony12;
using Hont.ExMethod.Collection;
using NovaEnv;
using Pathea.WeatherNs;
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityModManagerNet;
namespace PostProcessing
{
public static partial class Main
{
private static Settings settings;
private static bool enabled;
private static bool isDebug = false;
private static float labelWidth = 80f;
private static float indentSpace = 30f;
private static string[] toneMappers = new string[] {
"None",
"ACES",
"Neutral"
};
private static string[] kernelSizes = new string[] {
"Small",
"Medium",
"Large",
"Very Large"
};
private static string[] fxaaPresets = new string[] {
"Extreme Performance",
"Performance",
"Default",
"Quality",
"Extreme Quality"
};
private static Dictionary<string,int> sampleCounts = new Dictionary<string, int> {
{ "Lowest",3 },
{ "Low",6 },
{ "Medium",10 },
{ "High",16 },
};
public static void Dbgl(string str = "", bool pref = true)
{
if (isDebug)
UnityEngine.Debug.Log((pref ? "Post Processing " : "") + str);
}
private static void Load(UnityModManager.ModEntry modEntry)
{
settings = Settings.Load<Settings>(modEntry);
modEntry.OnToggle = OnToggle;
modEntry.OnGUI = OnGUI;
modEntry.OnSaveGUI = OnSaveGUI;
modEntry.OnUpdate = OnUpdate;
var harmony = HarmonyInstance.Create(modEntry.Info.Id);
harmony.PatchAll(Assembly.GetExecutingAssembly());
}
static void OnUpdate(UnityModManager.ModEntry modEntry, float dt)
{
if (Input.GetKeyDown(settings.ToggleKey))
{
modEntry.OnToggle(modEntry, !enabled);
}
}
private static void OnSaveGUI(UnityModManager.ModEntry modEntry)
{
settings.Save(modEntry);
}
private static void OnGUI(UnityModManager.ModEntry modEntry)
{
GUILayout.BeginHorizontal();
GUILayout.Label(string.Format("Toggle Hotkey:"), new GUILayoutOption[] { GUILayout.Width(labelWidth * 2) });
settings.ToggleKey = GUILayout.TextField(settings.ToggleKey, new GUILayoutOption[] { GUILayout.Width(labelWidth * 2) });
GUILayout.EndHorizontal();
GUILayout.Space(20f);
GUILayout.BeginHorizontal();
GUILayout.Space(indentSpace);
GUILayout.BeginVertical();
settings.customVignette = GUILayout.Toggle(settings.customVignette, $"<b>Use Custom Vignette</b>", new GUILayoutOption[0]);
if (settings.customVignette)
{
GUILayout.Space(10f);
GUILayout.BeginHorizontal();
GUILayout.Space(indentSpace);
GUILayout.BeginVertical();
GUILayout.Label("<b>Color</b>", new GUILayoutOption[0]);
GUILayout.BeginHorizontal();
GUILayout.Space(indentSpace);
GUILayout.BeginVertical();
GUILayout.Label(string.Format("Red: <b>{0:F2}</b> ", settings.vignetteColorRed), new GUILayoutOption[] { GUILayout.Width(labelWidth) });
settings.vignetteColorRed = GUILayout.HorizontalSlider((float)settings.vignetteColorRed * 100f, 0, 100f) / 100f;
GUILayout.Label(string.Format("Green: <b>{0:F2}</b> ", settings.vignetteColorRed), new GUILayoutOption[] { GUILayout.Width(labelWidth) });
settings.vignetteColorGreen = GUILayout.HorizontalSlider((float)settings.vignetteColorGreen * 100f, 0, 100f) / 100f;
GUILayout.Label(string.Format("Blue: <b>{0:F2}</b> ", settings.vignetteColorBlue), new GUILayoutOption[] { GUILayout.Width(labelWidth) });
settings.vignetteColorBlue = GUILayout.HorizontalSlider((float)settings.vignetteColorBlue * 100f, 0, 100f) / 100f;
GUILayout.Label(string.Format("Alpha: <b>{0:F2}</b> ", settings.vignetteColorAlpha), new GUILayoutOption[] { GUILayout.Width(labelWidth) });
settings.vignetteColorAlpha = GUILayout.HorizontalSlider((float)settings.vignetteColorAlpha * 100f, 0, 100f) / 100f;
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.Space(10f);
GUILayout.Label("<b>Center</b>", new GUILayoutOption[0]);
GUILayout.BeginHorizontal();
GUILayout.Space(indentSpace);
GUILayout.BeginVertical();
GUILayout.Label(string.Format("X: <b>{0:F2}</b> ", settings.vignetteX), new GUILayoutOption[] { GUILayout.Width(labelWidth) });
settings.vignetteX = GUILayout.HorizontalSlider((float)settings.vignetteX * 100f, 0, 100f) / 100f;
GUILayout.Label(string.Format("Y: <b>{0:F2}</b> ", settings.vignetteY), new GUILayoutOption[] { GUILayout.Width(labelWidth) });
settings.vignetteY = GUILayout.HorizontalSlider((float)settings.vignetteY * 100f, 0, 100f) / 100f;
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.Space(10f);
GUILayout.Label(string.Format("Intensity <b>{0:F2}</b> ", settings.vignetteIntensity), new GUILayoutOption[0]);
settings.vignetteIntensity = GUILayout.HorizontalSlider((float)settings.vignetteIntensity * 100f, 0, 100f) / 100f;
GUILayout.Space(10f);
GUILayout.Label(string.Format("Smoothness <b>{0:F2}</b> ", settings.vignetteSmoothness), new GUILayoutOption[0]);
settings.vignetteSmoothness = GUILayout.HorizontalSlider((float)settings.vignetteSmoothness * 100f, 1, 100f) / 100f;
GUILayout.Space(10f);
GUILayout.Label(string.Format("Roundness <b>{0:F2}</b> ", settings.vignetteRoundness), new GUILayoutOption[0]);
settings.vignetteRoundness = GUILayout.HorizontalSlider((float)settings.vignetteRoundness * 100f, 0, 100f) / 100f;
GUILayout.Space(10f);
settings.vignetteRounded = GUILayout.Toggle(settings.vignetteRounded, "<b>Force Round Vignette</b>", new GUILayoutOption[0]);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
GUILayout.Space(10f);
settings.customBloom = GUILayout.Toggle(settings.customBloom, "<b>Use Custom Bloom</b>", new GUILayoutOption[0]);
if (settings.customBloom)
{
GUILayout.Space(10f);
GUILayout.BeginHorizontal();
GUILayout.Space(indentSpace);
GUILayout.BeginVertical();
GUILayout.Label(new GUIContent(string.Format("Intensity <b>{0:F2}</b> ", settings.bloomIntensity), "Strength of the bloom filter."), new GUILayoutOption[0]);
settings.bloomIntensity = GUILayout.HorizontalSlider((float)settings.bloomIntensity * 100f, 0, 1000f) / 100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Threshold <b>{0:F2}</b> ", settings.bloomThreshold), "Filters out pixels under this level of brightness."), new GUILayoutOption[0]);
settings.bloomThreshold = GUILayout.HorizontalSlider((float)settings.bloomThreshold * 100f, 0, 1000f) / 100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Soft Knee <b>{0:F2}</b> ", settings.bloomSoftKnee), "Makes transition between under/over-threshold gradual (0 = hard threshold, 1 = soft threshold)."), new GUILayoutOption[0]);
settings.bloomSoftKnee = GUILayout.HorizontalSlider((float)settings.bloomSoftKnee * 100f, 0, 100f) / 100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Radius <b>{0:F2}</b> ", settings.bloomRadius), "Changes extent of veiling effects in a screen resolution-independent fashion."), new GUILayoutOption[0]);
settings.bloomRadius = GUILayout.HorizontalSlider((float)settings.bloomRadius * 10f, 10, 70f) / 10f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Lens Dirt Intensity <b>{0:F2}</b> ", settings.bloomLensDirtIntensity), "Amount of lens dirtiness."), new GUILayoutOption[0]);
settings.bloomLensDirtIntensity = GUILayout.HorizontalSlider((float)settings.bloomLensDirtIntensity * 100f, 0, 1000f) / 100f;
GUILayout.Space(10f);
settings.bloomAntiFlicker = GUILayout.Toggle(settings.bloomAntiFlicker, new GUIContent("<b>Anti-flicker</b>", "Reduces flashing noise with an additional filter."), new GUILayoutOption[0]);
GUILayout.Space(10f);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
GUILayout.Space(10f);
settings.customEyeAdapt = GUILayout.Toggle(settings.customEyeAdapt, "<b>Use Custom Eye Adaptation</b>", new GUILayoutOption[0]);
if (settings.customEyeAdapt)
{
GUILayout.Space(10f);
GUILayout.BeginHorizontal();
GUILayout.Space(indentSpace);
GUILayout.BeginVertical();
GUILayout.Label(new GUIContent(string.Format("Low Percent <b>{0:F0}</b> ", settings.eyeAdaptLowPercent), "Filters the dark part of the histogram when computing the average luminance to avoid very dark pixels from contributing to the auto exposure. Unit is in percent."), new GUILayoutOption[0]);
settings.eyeAdaptLowPercent = GUILayout.HorizontalSlider((float)settings.eyeAdaptLowPercent, 1f, 99f);
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("High Percent <b>{0:F0}</b> ", settings.eyeAdaptHighPercent), "Filters the bright part of the histogram when computing the average luminance to avoid very dark pixels from contributing to the auto exposure. Unit is in percent."), new GUILayoutOption[0]);
settings.eyeAdaptHighPercent = GUILayout.HorizontalSlider((float)settings.eyeAdaptHighPercent, 1f, 99f);
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Min Avg Luminance for AE<b>{0:F2}</b> ", settings.eyeAdaptMinLuminance), "Minimum average luminance to consider for auto exposure (in EV)."), new GUILayoutOption[0]);
settings.eyeAdaptMinLuminance = GUILayout.HorizontalSlider((float)settings.eyeAdaptMinLuminance * 100f, -600, 2100f) / 100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Max Avg Luminance for AE<b>{0:F2}</b> ", settings.eyeAdaptMaxLuminance), "Maximum average luminance to consider for auto exposure (in EV)."), new GUILayoutOption[0]);
settings.eyeAdaptMaxLuminance = GUILayout.HorizontalSlider((float)settings.eyeAdaptMaxLuminance * 100f, -600, 2100f) / 100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Exposure Bias<b>{0:F2}</b> ", settings.eyeAdaptKeyValue), "Exposure bias. Use this to offset the global exposure of the scene."), new GUILayoutOption[0]);
settings.eyeAdaptKeyValue = GUILayout.HorizontalSlider((float)settings.eyeAdaptKeyValue * 100f, 0, 100f) / 100f;
GUILayout.Space(10f);
settings.eyeAdaptDynamicKeyValue = GUILayout.Toggle(settings.eyeAdaptDynamicKeyValue, new GUIContent("<b>Dynamic Key Value</b>", "Turn this on to let Unity handle the key value automatically based on average luminance."), new GUILayoutOption[0]);
GUILayout.Space(10f);
settings.eyeAdaptAdaptationFixed = GUILayout.Toggle(settings.eyeAdaptAdaptationFixed, new GUIContent("<b>Fixed Eye Adaptation</b>", "Turn off if you want the auto exposure to be animated."), new GUILayoutOption[0]);
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Dark-to-light Adaptation Speed <b>{0:F2}</b> ", settings.eyeAdaptSpeedUp), "Adaptation speed from a dark to a light environment."), new GUILayoutOption[0]);
settings.eyeAdaptSpeedUp = GUILayout.HorizontalSlider((float)settings.eyeAdaptSpeedUp * 100f, 0, 1000f) / 100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Light-to-dark Adaptation Speed <b>{0:F2}</b> ", settings.eyeAdaptSpeedDown), "Adaptation speed from a light to a dark environment."), new GUILayoutOption[0]);
settings.eyeAdaptSpeedDown = GUILayout.HorizontalSlider((float)settings.eyeAdaptSpeedDown * 100f, 0, 1000f) / 100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Brightness Range Min<b>{0}</b> ", settings.eyeAdaptLogMin), "Lower bound for the brightness range of the generated histogram (in EV). The bigger the spread between min & max, the lower the precision will be."), new GUILayoutOption[0]);
settings.eyeAdaptLogMin = (int)GUILayout.HorizontalSlider((float)settings.eyeAdaptLogMin, -16f, -1f);
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Brightness Range Max<b>{0}</b> ", settings.eyeAdaptLogMax), "Upper bound for the brightness range of the generated histogram (in EV). The bigger the spread between min & max, the lower the precision will be."), new GUILayoutOption[0]);
settings.eyeAdaptLogMax = (int)GUILayout.HorizontalSlider((float)settings.eyeAdaptLogMax, 1f, 16f);
GUILayout.Space(10f);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
GUILayout.Space(10f);
settings.customMotionBlur = GUILayout.Toggle(settings.customMotionBlur, "<b>Use Custom Motion Blur</b>", new GUILayoutOption[0]);
if (settings.customMotionBlur)
{
GUILayout.Space(10f);
GUILayout.BeginHorizontal();
GUILayout.Space(indentSpace);
GUILayout.BeginVertical();
GUILayout.Label(new GUIContent(string.Format("Shutter Angle <b>{0:F0}</b> ", settings.motionBlurShutterAngle), "The angle of rotary shutter. Larger values give longer exposure."), new GUILayoutOption[0]);
settings.motionBlurShutterAngle = GUILayout.HorizontalSlider((float)settings.motionBlurShutterAngle, 0f, 360f);
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Sample Count <b>{0}</b> ", settings.eyeAdaptLogMin), "The amount of sample points, which affects quality and performances."), new GUILayoutOption[0]);
settings.eyeAdaptLogMin = (int)GUILayout.HorizontalSlider((float)settings.eyeAdaptLogMin, 4f, 32f);
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Frame Blending <b>{0:F2}</b> ", settings.motionBlurFrameBlending), "The strength of multiple frame blending. The opacity of preceding frames are determined from this coefficient and time differences."), new GUILayoutOption[0]);
settings.motionBlurFrameBlending = GUILayout.HorizontalSlider((float)settings.motionBlurFrameBlending * 100f, 0, 100f) / 100f;
GUILayout.Space(10f);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
GUILayout.Space(10f);
settings.customDepthOfField = GUILayout.Toggle(settings.customDepthOfField, "<b>Use Custom Depth of Field</b>", new GUILayoutOption[0]);
if (settings.customDepthOfField)
{
GUILayout.Space(10f);
GUILayout.BeginHorizontal();
GUILayout.Space(indentSpace);
GUILayout.BeginVertical();
GUILayout.Label(new GUIContent(string.Format("Focus Distance <b>{0:F2}</b> ", settings.depthOfFieldFocusDistance), "Distance to the point of focus."), new GUILayoutOption[0]);
settings.depthOfFieldFocusDistance = GUILayout.HorizontalSlider((float)settings.depthOfFieldFocusDistance*100f, 10f, 1000f)/100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Aperature <b>{0:F2}</b> ", settings.depthOfFieldAperture), "Ratio of aperture (known as f-stop or f-number). The smaller the value is, the shallower the depth of field is."), new GUILayoutOption[0]);
settings.depthOfFieldAperture = GUILayout.HorizontalSlider((float)settings.depthOfFieldAperture * 100f, 5f, 3200f)/100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Focal Length <b>{0:F0}</b> ", settings.depthOfFieldFocalLength), "Distance between the lens and the film. The larger the value is, the shallower the depth of field is."), new GUILayoutOption[0]);
settings.depthOfFieldFocalLength = GUILayout.HorizontalSlider((float)settings.depthOfFieldFocalLength, 1f, 300f);
GUILayout.Space(10f);
settings.depthOfFieldUseCameraFov = GUILayout.Toggle(settings.depthOfFieldUseCameraFov, new GUIContent("Calculate the focal length automatically from the field-of-view value set on the camera. Using this setting isn't recommended."), new GUILayoutOption[0]);
GUILayout.Label(new GUIContent(string.Format("Kernel Size <b>{0:F2}</b> ", kernelSizes[settings.depthOfFieldKernelSize]), "Convolution kernel size of the bokeh filter, which determines the maximum radius of bokeh. It also affects the performance (the larger the kernel is, the longer the GPU time is required)."), new GUILayoutOption[0]);
settings.depthOfFieldKernelSize = (int)GUILayout.HorizontalSlider((float)settings.depthOfFieldKernelSize, 0f, 3f);
GUILayout.Space(10f);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
GUILayout.Space(10f);
settings.customColorGrading = GUILayout.Toggle(settings.customColorGrading, "<b>Use Custom Color Grading</b>", new GUILayoutOption[0]);
if (settings.customColorGrading)
{
GUILayout.Space(10f);
GUILayout.BeginHorizontal();
GUILayout.Space(indentSpace);
GUILayout.BeginVertical();
GUILayout.Label(new GUIContent(string.Format("Tone Mapper <b>{0}</b> ", toneMappers[settings.colorGradingTonemapper]), "Tonemapping algorithm to use at the end of the color grading process. Use \"Neutral\" if you need a customizable tonemapper."), new GUILayoutOption[0]);
settings.colorGradingTonemapper = (int)GUILayout.HorizontalSlider((float)settings.colorGradingTonemapper, 0f, 2f);
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Neutral Black In <b>{0:F2}</b> ", settings.colorGradingNeutralBlackIn), ""), new GUILayoutOption[0]);
settings.colorGradingNeutralBlackIn = GUILayout.HorizontalSlider((float)settings.colorGradingNeutralBlackIn * 100f, -10f, 10f) / 100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Neutral White In <b>{0:F1}</b> ", settings.colorGradingNeutralWhiteIn), ""), new GUILayoutOption[0]);
settings.colorGradingNeutralWhiteIn = GUILayout.HorizontalSlider((float)settings.colorGradingNeutralWhiteIn * 10f, 10, 200f) / 10f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Neutral Black Out <b>{0:F2}</b> ", settings.colorGradingNeutralBlackOut), ""), new GUILayoutOption[0]);
settings.colorGradingNeutralBlackOut = GUILayout.HorizontalSlider((float)settings.colorGradingNeutralBlackOut * 100f, -9f, 10f) / 100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Neutral White Out <b>{0:F1}</b> ", settings.colorGradingNeutralWhiteOut), ""), new GUILayoutOption[0]);
settings.colorGradingNeutralWhiteOut = GUILayout.HorizontalSlider((float)settings.colorGradingNeutralWhiteOut * 10f, 10, 190f) / 10f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Neutral White Level <b>{0:F1}</b> ", settings.colorGradingNeutralWhiteLevel), ""), new GUILayoutOption[0]);
settings.colorGradingNeutralWhiteLevel = GUILayout.HorizontalSlider((float)settings.colorGradingNeutralWhiteLevel * 10f, 1f, 200f) / 10f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Neutral White Clip <b>{0:F1}</b> ", settings.colorGradingNeutralWhiteClip), ""), new GUILayoutOption[0]);
settings.colorGradingNeutralWhiteClip = GUILayout.HorizontalSlider((float)settings.colorGradingNeutralWhiteClip * 10f, 10f, 100f) / 10f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Post Exposure <b>{0:F2}</b> ", settings.colorGradingPostExposure), "Adjusts the overall exposure of the scene in EV units. This is applied after HDR effect and right before tonemapping so it won't affect previous effects in the chain."), new GUILayoutOption[0]);
settings.colorGradingPostExposure = GUILayout.HorizontalSlider((float)settings.colorGradingPostExposure * 100f, -600, 2100f) / 100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Temperature <b>{0:F1}</b> ", settings.colorGradingTemperature), "Sets the white balance to a custom color temperature."), new GUILayoutOption[0]);
settings.colorGradingTemperature = GUILayout.HorizontalSlider((float)settings.colorGradingTemperature * 10f, -1000, 1000f) / 10f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Tint <b>{0:F1}</b> ", settings.colorGradingTint), "Sets the white balance to compensate for a green or magenta tint."), new GUILayoutOption[0]);
settings.colorGradingTint = GUILayout.HorizontalSlider((float)settings.colorGradingTint * 10f, -1000f, 1000f) / 10f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Hue Shift <b>{0:F0}</b> ", settings.colorGradingHueShift), ""), new GUILayoutOption[0]);
settings.colorGradingHueShift = GUILayout.HorizontalSlider((float)settings.colorGradingHueShift, -180f, 180f);
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Saturation <b>{0:F2}</b> ", settings.colorGradingSaturation), "Pushes the intensity of all colors."), new GUILayoutOption[0]);
settings.colorGradingSaturation = GUILayout.HorizontalSlider((float)settings.colorGradingSaturation * 100f, 0f, 100f) / 100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Contrast <b>{0:F2}</b> ", settings.colorGradingContrast), "Expands or shrinks the overall range of tonal values."), new GUILayoutOption[0]);
settings.colorGradingContrast = GUILayout.HorizontalSlider((float)settings.colorGradingContrast * 100f, 0f, 100f) / 100f;
GUILayout.Space(10f);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
GUILayout.Space(10f);
settings.customAO = GUILayout.Toggle(settings.customAO, "<b>Use Custom Ambient Occlusion</b>", new GUILayoutOption[0]);
if (settings.customAO)
{
GUILayout.Space(10f);
GUILayout.BeginHorizontal();
GUILayout.Space(indentSpace);
GUILayout.BeginVertical();
GUILayout.Label(new GUIContent(string.Format("Intensity <b>{0:F2}</b> ", settings.AOIntensity), "Degree of darkness produced by the effect."), new GUILayoutOption[0]);
settings.AOIntensity = GUILayout.HorizontalSlider((float)settings.AOIntensity * 100f, 0f, 400f) / 100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Radius <b>{0:F2}</b> ", settings.AORadius), "Radius of sample points, which affects extent of darkened areas."), new GUILayoutOption[0]);
settings.AORadius = GUILayout.HorizontalSlider((float)settings.AORadius * 10000f, 1f, 10000) / 10000f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Sample Count <b>{0:F2}</b> ", sampleCounts.Keys.ToArray()[settings.AOSampleCount]), "Number of sample points, which affects quality and performance."), new GUILayoutOption[0]);
settings.AOSampleCount = (int)GUILayout.HorizontalSlider((float)settings.AOSampleCount, 0f, 3f);
GUILayout.Space(10f);
settings.AODownsampling = GUILayout.Toggle(settings.AODownsampling, new GUIContent("Downsample", "Halves the resolution of the effect to increase performance at the cost of visual quality."), new GUILayoutOption[0]);
GUILayout.Space(10f);
settings.AOForceForwardCompatibility = GUILayout.Toggle(settings.AOForceForwardCompatibility, new GUIContent("Force Forward Compatibility", "Forces compatibility with Forward rendered objects when working with the Deferred rendering path."), new GUILayoutOption[0]);
GUILayout.Space(10f);
settings.AOAmbientOnly = GUILayout.Toggle(settings.AOAmbientOnly, new GUIContent("Ambient Only", "Enables the ambient-only mode in that the effect only affects ambient lighting. This mode is only available with the Deferred rendering path and HDR rendering."), new GUILayoutOption[0]);
GUILayout.Space(10f);
settings.AOHighPrecision = GUILayout.Toggle(settings.AOHighPrecision, new GUIContent("High Precision", "Toggles the use of a higher precision depth texture with the forward rendering path (may impact performances). Has no effect with the deferred rendering path."), new GUILayoutOption[0]);
GUILayout.Space(10f);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
/*
GUILayout.Space(10f);
settings.customAA = GUILayout.Toggle(settings.customAA, "<b>Use Custom Anti-Aliasing</b>", new GUILayoutOption[0]);
if (settings.customAA)
{
GUILayout.Space(10f);
GUILayout.BeginHorizontal();
GUILayout.Space(indentSpace);
GUILayout.BeginVertical();
settings.AAMethodTaa = !GUILayout.Toggle(!settings.AAMethodTaa, "<b>Use Fxaa Anti-Aliasing</b>", new GUILayoutOption[0]);
settings.AAMethodTaa = GUILayout.Toggle(settings.AAMethodTaa, "<b>Use Taa Anti-Aliasing</b>", new GUILayoutOption[0]);
if (settings.AAMethodTaa)
{
GUILayout.Label(new GUIContent(string.Format("Jitter Spread <b>{0:F2}</b> ", settings.AAJitterSpread), "The diameter (in texels) inside which jitter samples are spread. Smaller values result in crisper but more aliased output, while larger values result in more stable but blurrier output."), new GUILayoutOption[0]);
settings.AAJitterSpread = GUILayout.HorizontalSlider((float)settings.AAJitterSpread*100f, 10f, 100f)/100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Sharpen <b>{0:F2}</b> ", settings.AASharpen), "Controls the amount of sharpening applied to the color buffer."), new GUILayoutOption[0]);
settings.AASharpen = GUILayout.HorizontalSlider((float)settings.AASharpen * 100f, 0, 300f)/100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Stationary Blending <b>{0:F2}</b> ", settings.AAStationaryBlending), "The blend coefficient for a stationary fragment. Controls the percentage of history sample blended into the final color."), new GUILayoutOption[0]);
settings.AAStationaryBlending = GUILayout.HorizontalSlider((float)settings.AAStationaryBlending * 100f, 0f, 99f)/100f;
GUILayout.Space(10f);
GUILayout.Label(new GUIContent(string.Format("Motion Blending <b>{0:F2}</b> ", settings.AAMotionBlending), "The blend coefficient for a fragment with significant motion. Controls the percentage of history sample blended into the final color."), new GUILayoutOption[0]);
settings.AAMotionBlending = GUILayout.HorizontalSlider((float)settings.AAMotionBlending * 100f, 0f, 99f)/100f;
}
else
{
GUILayout.Label(new GUIContent(string.Format("Fxaa Preset <b>{0}</b> ", fxaaPresets[settings.AAFxaaPreset]), ""), new GUILayoutOption[0]);
settings.AAFxaaPreset = (int)GUILayout.HorizontalSlider((float)settings.AAFxaaPreset, 0f, 4f);
}
GUILayout.Space(10f);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
*/
GUILayout.Space(20f);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
// Called when the mod is turned to on/off.
static bool OnToggle(UnityModManager.ModEntry modEntry, bool value /* active or inactive */)
{
enabled = value;
return true; // Permit or not.
}
}
}