diff --git a/README.md b/README.md index 4e25c41..2b77752 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ - [Classic Matrix code](https://rezmason.github.io/matrix) - [3D mode](https://rezmason.github.io/matrix?volumetric=true) - [Matrix Resurrections code (WIP)](https://rezmason.github.io/matrix?version=resurrections) +- [Matrix Resurrections's updated code (WIP)](https://rezmason.github.io/matrix?version=updated) - [Operator Matrix code (with ripple effects)](https://rezmason.github.io/matrix?version=operator) - [Code of the "Nightmare Matrix"](https://rezmason.github.io/matrix?version=nightmare) - [(you know, this stuff).](http://matrix.wikia.com/wiki/Nightmare_Matrix) diff --git a/assets/resurrections_msdf.png b/assets/resurrections_msdf.png new file mode 100644 index 0000000..2af0b01 Binary files /dev/null and b/assets/resurrections_msdf.png differ diff --git a/js/config.js b/js/config.js index ce42806..4157d15 100644 --- a/js/config.js +++ b/js/config.js @@ -17,6 +17,12 @@ const fonts = { glyphSequenceLength: 57, glyphTextureGridSize: [8, 8], }, + resurrections: { + // The glyphs seen in the film trilogy + glyphTexURL: "assets/resurrections_msdf.png", + glyphSequenceLength: 133, + glyphTextureGridSize: [13, 12], + }, huberfishA: { glyphTexURL: "assets/huberfish_a_msdf.png", glyphSequenceLength: 34, @@ -149,6 +155,23 @@ const versions = { volumetric: true, fallSpeed: 0.4, }, + updated: { + ...defaults, + ...fonts.resurrections, + numColumns: 108, + fallSpeed: 0.35, + cycleStyle: "cycleRandomly", + cycleSpeed: 0.8, + glyphEdgeCrop: 0.1, + paletteEntries: [ + { hsl: [0.39, 0.9, 0.0], at: 0.0 }, + { hsl: [0.39, 1.0, 0.6], at: 0.5 }, + { hsl: [0.39, 1.0, 1.0], at: 1.0 }, + ], + raindropLength: 1.4, + highPassThreshold: 0.2, + cursorEffectThreshold: 0.8, + }, palimpsest: { ...defaults, ...fonts.huberfishA, diff --git a/js/webgpu/utils.js b/js/webgpu/utils.js index a5a4469..7fab8c9 100644 --- a/js/webgpu/utils.js +++ b/js/webgpu/utils.js @@ -117,15 +117,4 @@ const makePass = (loaded, build, run) => ({ const makePipeline = (context, steps) => steps.filter((f) => f != null).map((f) => f(context)); -export { - getCanvasSize, - makeRenderTarget, - makeComputeTarget, - make1DTexture, - loadTexture, - loadShader, - makeUniformBuffer, - makePass, - makePipeline, - makeBindGroup, -}; +export { getCanvasSize, makeRenderTarget, makeComputeTarget, make1DTexture, loadTexture, loadShader, makeUniformBuffer, makePass, makePipeline, makeBindGroup }; diff --git a/shaders/glsl/rainPass.frag.glsl b/shaders/glsl/rainPass.frag.glsl index 4b82175..c2ec7e6 100644 --- a/shaders/glsl/rainPass.frag.glsl +++ b/shaders/glsl/rainPass.frag.glsl @@ -24,9 +24,9 @@ float median3(vec3 i) { } vec2 getSymbolUV(float glyphCycle) { - float symbol = floor(glyphSequenceLength * glyphCycle); - float symbolX = mod(symbol, glyphTextureGridSize.x); - float symbolY = floor(symbol / glyphTextureGridSize.y); + float symbol = floor((glyphSequenceLength) * glyphCycle) + 1.0; + float symbolX = mod(symbol, glyphTextureGridSize.x) - 1.0; + float symbolY = glyphTextureGridSize.y - 1.0 - (mod(floor(symbol / glyphTextureGridSize.x), glyphTextureGridSize.y)); return vec2(symbolX, symbolY); }