19
19
20
20
// Bloom-specific settings
21
21
#if ENABLE_BLOOM
22
- uniform int _RenderMode <
22
+ uniform int _BloomRenderMode <
23
23
ui_label = "Bloom" ;
24
24
ui_type = "combo" ;
25
25
ui_items = "Base + Bloom\0 Bloom\0 " ;
26
26
> = 0 ;
27
27
28
- uniform float _Threshold <
28
+ uniform float _BloomThreshold <
29
29
ui_category = "Bloom" ;
30
30
ui_label = "Threshold" ;
31
31
ui_type = "slider" ;
32
32
ui_min = 0.0 ;
33
33
ui_max = 1.0 ;
34
34
> = 0.8 ;
35
35
36
- uniform float _Smooth <
36
+ uniform float _BloomSmoothing <
37
37
ui_category = "Bloom" ;
38
38
ui_label = "Smoothing" ;
39
39
ui_type = "slider" ;
40
40
ui_min = 0.0 ;
41
41
ui_max = 1.0 ;
42
42
> = 0.5 ;
43
43
44
- uniform float _Intensity <
44
+ uniform float _BloomIntensity <
45
45
ui_category = "Bloom" ;
46
46
ui_label = "Intensity" ;
47
47
ui_type = "slider" ;
50
50
ui_max = 1.0 ;
51
51
> = 0.5 ;
52
52
53
- uniform float3 _ColorShift <
53
+ uniform float3 _BloomColorShift <
54
54
ui_category = "Bloom" ;
55
55
ui_label = "Color Shift (RGB)" ;
56
56
ui_type = "color" ;
63
63
#if ENABLE_AUTOEXPOSURE
64
64
uniform float _Frametime < source = "frametime" ; >;
65
65
66
- uniform int _Meter <
67
- ui_category = "Auto- Exposure" ;
66
+ uniform int _ExposureMeter <
67
+ ui_category = "Exposure" ;
68
68
ui_label = "Method" ;
69
69
ui_type = "combo" ;
70
70
ui_items = "Average\0 Spot\0 " ;
71
71
> = 0 ;
72
72
73
- uniform float _Scale <
74
- ui_category = "Auto- Exposure" ;
73
+ uniform float _ExposureScale <
74
+ ui_category = "Exposure" ;
75
75
ui_label = "Spot Scale" ;
76
76
ui_type = "slider" ;
77
77
ui_min = 0.0 ;
78
78
ui_max = 1.0 ;
79
79
> = 0.5 ;
80
80
81
- uniform float2 _Offset <
82
- ui_category = "Auto- Exposure" ;
81
+ uniform float2 _ExposureOffset <
82
+ ui_category = "Exposure" ;
83
83
ui_label = "Spot Offset" ;
84
84
ui_type = "slider" ;
85
85
ui_min = -1.0 ;
86
86
ui_max = 1.0 ;
87
87
> = 0.0 ;
88
88
89
- uniform bool _DisplayAverageLumaOverlay <
90
- ui_category = "Auto- Exposure" ;
89
+ uniform bool _ExposureLumaOverlay <
90
+ ui_category = "Exposure" ;
91
91
ui_label = "Display Average Luminance" ;
92
92
ui_type = "radio" ;
93
93
> = false ;
94
94
95
- uniform bool _DisplaySpotMeterOverlay <
96
- ui_category = "Auto- Exposure" ;
95
+ uniform bool _ExposureSpotMeterOverlay <
96
+ ui_category = "Exposure" ;
97
97
ui_label = "Display Spot Metering" ;
98
98
ui_type = "radio" ;
99
99
> = false ;
163
163
#else
164
164
SpotMeterTex.y /= ASPECT_RATIO;
165
165
#endif
166
- SpotMeterTex *= _Scale ;
167
- SpotMeterTex += float2 (_Offset .x, -_Offset .y);
166
+ SpotMeterTex *= _ExposureScale ;
167
+ SpotMeterTex += float2 (_ExposureOffset .x, -_ExposureOffset .y);
168
168
SpotMeterTex = (SpotMeterTex * 0.5 ) + 0.5 ;
169
169
170
170
return SpotMeterTex;
178
178
Height conversion | [0, 1] -> [-N, N]
179
179
*/
180
180
float2 OverlayPos = UnormTex;
181
- OverlayPos -= float2 (_Offset .x, -_Offset .y);
182
- OverlayPos /= _Scale ;
181
+ OverlayPos -= float2 (_ExposureOffset .x, -_ExposureOffset .y);
182
+ OverlayPos /= _ExposureScale ;
183
183
184
184
// Shrink the UV so [-1, 1] fills a square
185
185
#if BUFFER_WIDTH > BUFFER_HEIGHT
189
189
#endif
190
190
191
191
// Create the needed mask; output 1 if the texcoord is within square range
192
- float Factor = 1.0 * _Scale ;
192
+ float Factor = 1.0 * _ExposureScale ;
193
193
float SquareMask = all (abs (OverlayPos) <= Factor);
194
194
float DotMask = CProcedural_GetAntiAliasShape (length (OverlayPos), Factor * 0.1 );
195
195
250
250
// Apply auto-exposure to the backbuffer
251
251
#if ENABLE_AUTOEXPOSURE
252
252
// Store log luminance in the alpha channel
253
- if (_Meter == 1 )
253
+ if (_ExposureMeter == 1 )
254
254
{
255
255
float3 ColorArea = CShade_BackBuffer2D (GetSpotMeterTex (Input.Tex0)).rgb;
256
256
Luminance = CCamera_GetLogLuminance (ColorArea.rgb);
267
267
#endif
268
268
269
269
// Thresholding phase
270
- const float Knee = mad (_Threshold, _Smooth , 1e-5 );
271
- const float3 Curve = float3 (_Threshold - Knee, Knee * 2.0 , 0.25 / Knee);
270
+ const float Knee = mad (_BloomThreshold, _BloomSmoothing , 1e-5 );
271
+ const float3 Curve = float3 (_BloomThreshold - Knee, Knee * 2.0 , 0.25 / Knee);
272
272
273
273
// Under-threshold
274
274
float Brightness = CColor_GetLuma (Color.rgb, 3 );
275
275
float ResponseCurve = clamp (Brightness - Curve.x, 0.0 , Curve.y);
276
276
ResponseCurve = Curve.z * ResponseCurve * ResponseCurve;
277
277
278
278
// Combine and apply the brightness response curve
279
- Color = Color * max (ResponseCurve, Brightness - _Threshold ) / max (Brightness, 1e-10 );
279
+ Color = Color * max (ResponseCurve, Brightness - _BloomThreshold ) / max (Brightness, 1e-10 );
280
280
281
- return float4 (Color.rgb * _ColorShift , Luminance);
281
+ return float4 (Color.rgb * _BloomColorShift , Luminance);
282
282
}
283
283
284
284
#define CREATE_PS_DOWNSCALE (METHOD_NAME, SAMPLER, FLICKER_FILTER) \
@@ -325,8 +325,8 @@ float4 PS_Composite(CShade_VS2PS_Quad Input) : SV_TARGET0
325
325
326
326
// Bloom composition
327
327
#if ENABLE_BLOOM
328
- float3 BloomColor = tex2D (SampleTempTex1, Input.Tex0).rgb * _Intensity ;
329
- BaseColor = (_RenderMode == 0 ) ? BaseColor + BloomColor : BloomColor;
328
+ float3 BloomColor = tex2D (SampleTempTex1, Input.Tex0).rgb * _BloomIntensity ;
329
+ BaseColor = (_BloomRenderMode == 0 ) ? BaseColor + BloomColor : BloomColor;
330
330
#endif
331
331
332
332
// Apply tonemapping
@@ -336,17 +336,17 @@ float4 PS_Composite(CShade_VS2PS_Quad Input) : SV_TARGET0
336
336
#if ENABLE_AUTOEXPOSURE
337
337
float2 UnormTex = (Input.Tex0 * 2.0 ) - 1.0 ;
338
338
339
- if (_DisplaySpotMeterOverlay )
339
+ if (_ExposureSpotMeterOverlay )
340
340
{
341
341
ApplySpotMeterOverlay (BaseColor, UnormTex, NonExposedColor);
342
342
}
343
343
344
- if (_DisplayAverageLumaOverlay )
344
+ if (_ExposureLumaOverlay )
345
345
{
346
346
ApplyAverageLumaOverlay (BaseColor, UnormTex, ExposureData);
347
347
}
348
348
#endif
349
-
349
+ BaseColor = saturate (BaseColor);
350
350
return CBlend_OutputChannels (float4 (BaseColor, _CShadeAlphaFactor));
351
351
}
352
352
@@ -363,7 +363,6 @@ float4 PS_Composite(CShade_VS2PS_Quad Input) : SV_TARGET0
363
363
RenderTarget0 = RENDER_TARGET; \
364
364
}
365
365
366
-
367
366
technique CShade_RaySchism < ui_tooltip = "CShade's Color Multi-tool." ; >
368
367
{
369
368
#if ENABLE_BLOOM
0 commit comments