-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
trixky
committed
Aug 15, 2024
1 parent
05fa6d2
commit c23a170
Showing
25 changed files
with
634 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
node_modules | ||
*.toto | ||
|
||
|
||
# Output | ||
.output | ||
|
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
18 changes: 18 additions & 0 deletions
18
src/lib/shaders/post-processing/displacement/fragment.glsl
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,18 @@ | ||
varying vec2 vUv; | ||
uniform sampler2D tDiffuse; | ||
uniform float uTime; | ||
|
||
uniform float uSpeed; | ||
uniform float uXAmplitude; | ||
uniform float uYAmplitude; | ||
uniform float uXFrequency; | ||
uniform float uYFrequency; | ||
|
||
void main() { | ||
vec2 newVUv = vUv; | ||
newVUv = vec2(vUv.x + sin((vUv.y + uTime * uSpeed * 0.5 * uXFrequency) * 30.0) * 0.02 * uXAmplitude, vUv.y + cos((vUv.x + uTime * uSpeed * 0.5 * uYFrequency) * 30.0) * 0.02 * uYAmplitude); | ||
|
||
vec4 color = texture2D(tDiffuse, newVUv); | ||
|
||
gl_FragColor = vec4(color); | ||
} |
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,6 @@ | ||
varying vec2 vUv; | ||
|
||
void main() { | ||
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); | ||
vUv = uv; | ||
} |
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,19 @@ | ||
varying vec2 vUv; | ||
uniform sampler2D tDiffuse; | ||
uniform sampler2D uNormal; | ||
uniform float uNormalStrength; | ||
uniform float uBrightnessStrength; | ||
|
||
void main() { | ||
vec2 newVUv = vUv; | ||
float lightness = 0.0; | ||
|
||
vec3 normalColor = texture2D(uNormal, vUv).xyz * 2.0 - 1.0; | ||
newVUv += normalColor.xy * uNormalStrength; | ||
vec3 lightDirection = normalize(vec3(-1.0, 1.0, 0.0)); | ||
lightness = clamp(dot(normalize(normalColor), lightDirection), 0.0, 1.0); | ||
|
||
vec4 color = texture2D(tDiffuse, newVUv) + lightness * uBrightnessStrength; | ||
|
||
gl_FragColor = vec4(color); | ||
} |
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,6 @@ | ||
varying vec2 vUv; | ||
|
||
void main() { | ||
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); | ||
vUv = uv; | ||
} |
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,16 @@ | ||
varying vec2 vUv; | ||
uniform sampler2D tDiffuse; | ||
uniform vec3 uTint; | ||
uniform float uColorAlpha; | ||
uniform float uColorOverride; | ||
|
||
void main() { | ||
vec4 color = texture2D(tDiffuse, vUv); | ||
|
||
vec3 newColor = color.rgb; | ||
newColor += uTint * uColorAlpha; | ||
newColor = mix(newColor, uTint, uColorOverride); | ||
color = vec4(newColor, 1.0); | ||
|
||
gl_FragColor = vec4(color); | ||
} |
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,6 @@ | ||
varying vec2 vUv; | ||
|
||
void main() { | ||
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); | ||
vUv = uv; | ||
} |
Oops, something went wrong.