generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Intro Sound Effect and Blur effect (Credit: mineblock11)
- Include Blur Shader Program (Credit: @glisco) Co-Authored-By: Calum <93472213+mineblock11@users.noreply.github.com>
- Loading branch information
1 parent
e5063f4
commit 3e489d5
Showing
14 changed files
with
300 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
common/src/main/resources/assets/seamless_loading_screen/shaders/core/blur.fsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#version 150 | ||
|
||
uniform sampler2D InputSampler; | ||
uniform vec2 InputResolution; | ||
uniform vec4 ColorModulator; | ||
|
||
uniform float Directions; | ||
uniform float Quality; | ||
uniform float Size; | ||
|
||
out vec4 fragColor; | ||
|
||
// Copy of https://github.com/wisp-forest/owo-lib/blob/1.20/src/main/resources/assets/owo/shaders/core/blur.fsh from owo | ||
// shader adapted from https://www.shadertoy.com/view/Xltfzj | ||
|
||
void main() { | ||
#define TAU 6.28318530718 | ||
|
||
vec2 Radius = Size / InputResolution.xy; | ||
|
||
// Normalized pixel coordinates (from 0 to 1) | ||
vec2 uv = gl_FragCoord.xy / InputResolution.xy; | ||
// Pixel colour | ||
vec4 Color = texture(InputSampler, uv); | ||
|
||
// Blur calculations | ||
for (float d = 0.0; d < TAU; d += TAU / Directions) { | ||
for (float i = 1.0 / Quality; i <= 1.0; i += 1.0 / Quality) { | ||
Color += texture(InputSampler, uv + vec2(cos(d), sin(d)) * Radius * i); | ||
} | ||
} | ||
|
||
// Output to screen | ||
Color /= Quality * Directions; | ||
fragColor = Color * ColorModulator; | ||
} |
22 changes: 22 additions & 0 deletions
22
common/src/main/resources/assets/seamless_loading_screen/shaders/core/blur.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"blend": { | ||
"func": "add", | ||
"srcrgb": "srcalpha", | ||
"dstrgb": "1-srcalpha" | ||
}, | ||
"vertex": "position", | ||
"fragment": "seamless_loading_screen:blur", | ||
"attributes": [], | ||
"samplers": [ | ||
{ "name": "InputSampler" } | ||
], | ||
"uniforms": [ | ||
{ "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, | ||
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, | ||
{ "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, | ||
{ "name": "InputResolution", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, | ||
{ "name": "Directions", "type": "float", "count": 1, "values": [ 1.0] }, | ||
{ "name": "Quality", "type": "float", "count": 1, "values": [ 1.0] }, | ||
{ "name": "Size", "type": "float", "count": 1, "values": [ 1.0] } | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.