mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 06:51:17 +01:00
Updated Post Processing Shaders (markdown)
parent
c547ac0e91
commit
83f79ed5ee
@ -180,6 +180,131 @@ Takes the OptionName that was defined in the configuration
|
||||
```c++
|
||||
float3 colour_boost = GetOption(SKY_COLOR);
|
||||
```
|
||||
## Sample Shader
|
||||
---
|
||||
```c++
|
||||
/*
|
||||
[configuration]
|
||||
[OptionBool]
|
||||
GUIName = Skylight Bevel Shader
|
||||
OptionName = BEVEL
|
||||
DefaultValue = true
|
||||
|
||||
[OptionRangeFloat]
|
||||
GUIName = Skylight Amount
|
||||
OptionName = SKYLIGHT_AMOUNT
|
||||
MinValue = 0.0
|
||||
MaxValue = 1.0
|
||||
StepAmount = 0.05,
|
||||
DefaultValue = 0.5
|
||||
DependentOption = BEVEL
|
||||
|
||||
[OptionRangeFloat]
|
||||
GUIName = Sky Color
|
||||
OptionName = SKY_COLOR
|
||||
MinValue = 0.0, 0.0, 0.0
|
||||
MaxValue = 1.0, 1.0, 1.0
|
||||
StepAmount = 0.05, 0.05, 0.05
|
||||
DefaultValue = 0.1, 0.1, 0.5
|
||||
DependentOption = BEVEL
|
||||
|
||||
[OptionRangeFloat]
|
||||
GUIName = Base Color
|
||||
OptionName = BASE_COLOR
|
||||
MinValue = 0.0, 0.0, 0.0
|
||||
MaxValue = 1.0, 1.0, 1.0
|
||||
StepAmount = 0.05, 0.05, 0.05
|
||||
DefaultValue = 0.0, 0.0, 0.1
|
||||
DependentOption = BEVEL
|
||||
|
||||
[OptionRangeFloat]
|
||||
GUIName = Ground Color
|
||||
OptionName = GROUND_COLOR
|
||||
MinValue = 0.0, 0.0, 0.0
|
||||
MaxValue = 1.0, 1.0, 1.0
|
||||
StepAmount = 0.05, 0.05, 0.05
|
||||
DefaultValue = 0.1, 0.4, 0.1
|
||||
DependentOption = BEVEL
|
||||
|
||||
[OptionBool]
|
||||
GUIName = Sharpen
|
||||
OptionName = SHARPNESS
|
||||
DefaultValue = true
|
||||
|
||||
[OptionRangeFloat]
|
||||
GUIName = Sharpness Amount
|
||||
OptionName = SHARPNESS_VALUE
|
||||
MinValue = 0.0
|
||||
MaxValue = 10.0
|
||||
StepAmount = 0.5
|
||||
DefaultValue = 1.5
|
||||
DependentOption = SHARPNESS
|
||||
|
||||
[OptionBool]
|
||||
GUIName = Color Boost
|
||||
OptionName = COLOR_BOOST
|
||||
DefaultValue = true
|
||||
|
||||
[OptionRangeFloat]
|
||||
GUIName = Color Boost Red
|
||||
OptionName = RED_BOOST
|
||||
MinValue = 0.0
|
||||
MaxValue = 5.0
|
||||
StepAmount = 0.1
|
||||
DefaultValue = 1.0
|
||||
DependentOption = COLOR_BOOST
|
||||
|
||||
[OptionRangeFloat]
|
||||
GUIName = Color Boost Green
|
||||
OptionName = GREEN_BOOST
|
||||
MinValue = 0.0
|
||||
MaxValue = 5.0
|
||||
StepAmount = 0.1
|
||||
DefaultValue = 1.0
|
||||
DependentOption = COLOR_BOOST
|
||||
|
||||
[OptionRangeFloat]
|
||||
GUIName = Color Boost Blue
|
||||
OptionName = BLUE_BOOST
|
||||
MinValue = 0.0
|
||||
MaxValue = 5.0
|
||||
StepAmount = 0.1
|
||||
DefaultValue = 1.0
|
||||
DependentOption = COLOR_BOOST
|
||||
[/configuration]
|
||||
*/
|
||||
|
||||
void main() {
|
||||
float3 curr = Sample().xyz;
|
||||
|
||||
if (OptionEnabled(SHARPNESS))
|
||||
{
|
||||
float3 s0 = SampleOffset(int2(-1, -1)).xyz;
|
||||
float3 s1 = SampleOffset(int2( 1, -1)).xyz;
|
||||
float3 s2 = SampleOffset(int2(-1, 1)).xyz;
|
||||
float3 s3 = SampleOffset(int2( 1, 1)).xyz;
|
||||
float3 blur = (curr + s0 + s1 + s2 + s3) / 5;
|
||||
curr = curr + (curr - blur) * GetOption(SHARPNESS_VALUE);
|
||||
}
|
||||
|
||||
if (OptionEnabled(BEVEL))
|
||||
{
|
||||
float mid = dot(curr, float3(0.33, 0.33, 0.33));
|
||||
float top = dot(SampleOffset(int2(0, 1)).xyz, float3(0.33, 0.33, 0.33));
|
||||
float bot = dot(SampleOffset(int2(0, -1)).xyz, float3(0.33, 0.33, 0.33));
|
||||
float upw = ((top - mid) + (mid - bot)) / 4 + 0.5;
|
||||
float3 col = mix(GetOption(SKY_COLOR), GetOption(GROUND_COLOR), upw);
|
||||
float3 shde = mix(GetOption(BASE_COLOR), col, clamp(abs(upw * 2.0 - 1.0) * 1, 0.0, 1.0));
|
||||
curr = curr + shde * GetOption(SKYLIGHT_AMOUNT);
|
||||
}
|
||||
|
||||
if (OptionEnabled(COLOR_BOOST))
|
||||
curr = curr * float3(GetOption(RED_BOOST), GetOption(GREEN_BOOST), GetOption(BLUE_BOOST));
|
||||
|
||||
/* Done */
|
||||
SetOutput(float4(curr, 1.0));
|
||||
}
|
||||
```
|
||||
## Translations
|
||||
---
|
||||
**TBD**
|
Loading…
x
Reference in New Issue
Block a user