mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Postshader - New version of bloom
This commit is contained in:
parent
1253e60d19
commit
0729aa5d46
@ -820,6 +820,9 @@
|
||||
<None Include="Content\shaders\bloom.fsh">
|
||||
<DeploymentContent>true</DeploymentContent>
|
||||
</None>
|
||||
<None Include="Content\shaders\bloomnoblur.fsh">
|
||||
<DeploymentContent>true</DeploymentContent>
|
||||
</None>
|
||||
<None Include="Content\shaders\cartoon.fsh">
|
||||
<DeploymentContent>true</DeploymentContent>
|
||||
</None>
|
||||
|
@ -292,6 +292,9 @@
|
||||
<None Include="Content\shaders\bloom.fsh">
|
||||
<Filter>Content\shaders</Filter>
|
||||
</None>
|
||||
<None Include="Content\shaders\bloomnoblur.fsh">
|
||||
<Filter>Content\shaders</Filter>
|
||||
</None>
|
||||
<None Include="Content\shaders\cartoon.fsh">
|
||||
<Filter>Content\shaders</Filter>
|
||||
</None>
|
||||
|
43
assets/shaders/bloomnoblur.fsh
Normal file
43
assets/shaders/bloomnoblur.fsh
Normal file
@ -0,0 +1,43 @@
|
||||
// Simple Bloom shader; created to use in PPSSPP.
|
||||
// Without excessive samples and complex nested loops
|
||||
// (to make it compatible with low-end GPUs and to ensure ps_2_0 compatibility).
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
uniform sampler2D sampler0;
|
||||
varying vec2 v_texcoord0;
|
||||
|
||||
uniform vec4 u_setting;
|
||||
|
||||
void main()
|
||||
{
|
||||
//get the pixel color
|
||||
vec3 color = texture2D(sampler0, v_texcoord0.xy).xyz;
|
||||
gl_FragColor.rgb = color;
|
||||
float gray = (color.r + color.g + color.b) / 3.0;
|
||||
float saturation = (abs(color.r - gray) + abs(color.g - gray) + abs(color.b - gray)) / 3.0;
|
||||
|
||||
//show the effect mainly on bright parts of the screen
|
||||
float step = 0.001 * gray / max(saturation, 0.25) * u_setting.x;
|
||||
|
||||
//sum the neightbor pixels
|
||||
vec3 sum = vec3(0);
|
||||
for (int x = -3; x <= 3; x += 2)
|
||||
{
|
||||
for (int y = -3; y <= 3; y += 2)
|
||||
{
|
||||
color = texture2D(sampler0, v_texcoord0 + vec2(x, y)*step).xyz;
|
||||
gray = (color.r + color.g + color.b) / 3.0;
|
||||
saturation = (abs(color.r - gray) + abs(color.g - gray) + abs(color.b - gray)) / 3.0;
|
||||
sum += color * gray * gray / max(saturation, 0.25);
|
||||
}
|
||||
}
|
||||
sum /= 16.0;
|
||||
|
||||
//mix the color
|
||||
gl_FragColor.rgb += sum * u_setting.y;
|
||||
gl_FragColor.a = 1.0;
|
||||
}
|
@ -50,6 +50,18 @@ SettingName2=Power
|
||||
SettingDefaultValue2=0.5
|
||||
SettingMaxValue2=1.0
|
||||
SettingMinValue2=0.0
|
||||
[BloomNoBlur]
|
||||
Name=Bloom (no blur)r
|
||||
Fragment=bloomnoblur.fsh
|
||||
Vertex=fxaa.vsh
|
||||
SettingName1=Amount
|
||||
SettingDefaultValue1=0.6
|
||||
SettingMaxValue1=1.0
|
||||
SettingMinValue1=0.0
|
||||
SettingName2=Power
|
||||
SettingDefaultValue2=0.5
|
||||
SettingMaxValue2=1.0
|
||||
SettingMinValue2=0.0
|
||||
[Sharpen]
|
||||
Name=Sharpen
|
||||
Fragment=sharpen.fsh
|
||||
|
Loading…
Reference in New Issue
Block a user