-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Swapped our current bloom render path for an effect composer shader p…
…ath.
- Loading branch information
Showing
42 changed files
with
1,356 additions
and
1,022 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
uniform sampler2D blueNoiseTexture; | ||
uniform sampler2D outputImage; | ||
uniform float uTime; | ||
|
||
varying vec3 vWorldPosition; | ||
varying vec2 vUv; | ||
const vec3 inverseGamma = vec3(0.454545454545454545454545); | ||
const float sqrtOfOneHalf = 0.7071067811865475244008443; | ||
|
||
//From http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/ | ||
float rand(float x){ | ||
float a = 12.9898; | ||
float b = 78.233; | ||
float c = 43758.5453; | ||
float dt= dot(vec2(x, x) ,vec2(a,b)); | ||
float sn= mod(dt,3.14); | ||
return fract(sin(sn) * c); | ||
} | ||
|
||
//From The Book of Shaders :D | ||
//https://thebookofshaders.com/11/ | ||
float noise(float x){ | ||
float i = floor(x); | ||
float f = fract(x); | ||
float y = mix(rand(i), rand(i + 1.0), smoothstep(0.0,1.0,f)); | ||
|
||
return y; | ||
} | ||
|
||
//Including this because someone removed this in a future version of THREE. Why?! | ||
vec3 MyAESFilmicToneMapping(vec3 color) { | ||
return clamp((color * (2.51 * color + 0.03)) / (color * (2.43 * color + 0.59) + 0.14), 0.0, 1.0); | ||
} | ||
|
||
void main(){ | ||
float distanceFromCenter = distance(vUv, vec2(0.5)); | ||
float falloffDisk = clamp(smoothstep(0.0, 1.0, (sqrtOfOneHalf - min(distanceFromCenter * 2.7 - 0.8, 1.0))), 0.0, 1.0); | ||
vec3 combinedPass = texture(outputImage, vUv).rgb; | ||
combinedPass += (texelFetch(blueNoiseTexture, (ivec2(gl_FragCoord.xy) + ivec2(128.0 * noise(uTime), 128.0 * noise(uTime + 511.0))) % 128, 0).rgb - vec3(0.5)) / vec3(128.0); | ||
gl_FragColor = vec4(combinedPass, falloffDisk); | ||
} |
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.