mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-18 14:19:30 -07:00
Experimenting with a more expensive bloom.
This commit is contained in:
2
TODO.txt
2
TODO.txt
@@ -5,6 +5,8 @@ Experiment with varying the colors in the palette pass
|
|||||||
Maybe dim and widen the bloom
|
Maybe dim and widen the bloom
|
||||||
Just make sure the changes to non-default configurations are acceptable
|
Just make sure the changes to non-default configurations are acceptable
|
||||||
|
|
||||||
|
Maybe try and accomplish the effect in Photoshop, to get a sense of what's going on
|
||||||
|
|
||||||
Deja vu effect: flashing rows
|
Deja vu effect: flashing rows
|
||||||
Make them flash all the time
|
Make them flash all the time
|
||||||
Then use a thunder-like pattern to show and hide the flash
|
Then use a thunder-like pattern to show and hide the flash
|
||||||
|
|||||||
@@ -69,6 +69,16 @@ export default (regl, config, inputs) => {
|
|||||||
texture2D(tex, vUV + direction / max(width, height) * size) +
|
texture2D(tex, vUV + direction / max(width, height) * size) +
|
||||||
texture2D(tex, vUV - direction / max(width, height) * size)
|
texture2D(tex, vUV - direction / max(width, height) * size)
|
||||||
) * 0.279;
|
) * 0.279;
|
||||||
|
// gl_FragColor =
|
||||||
|
// texture2D(tex, vUV) * 0.38774 +
|
||||||
|
// (
|
||||||
|
// texture2D(tex, vUV + direction / max(width, height) * size * 0.5) +
|
||||||
|
// texture2D(tex, vUV - direction / max(width, height) * size * 0.5)
|
||||||
|
// ) * 0.24477 +
|
||||||
|
// (
|
||||||
|
// texture2D(tex, vUV + direction / max(width, height) * size) +
|
||||||
|
// texture2D(tex, vUV - direction / max(width, height) * size)
|
||||||
|
// ) * 0.06136;
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
uniforms: {
|
uniforms: {
|
||||||
|
|||||||
@@ -1,17 +1,9 @@
|
|||||||
import { make1DTexture, makePassFBO, makePass } from "./utils.js";
|
import { make1DTexture, makePassFBO, makePass } from "./utils.js";
|
||||||
|
|
||||||
// The rendered texture's values are mapped to colors in a palette texture.
|
const makePalette = (regl, entries) => {
|
||||||
// A little noise is introduced, to hide the banding that appears
|
|
||||||
// in subtle gradients. The noise is also time-driven, so its grain
|
|
||||||
// won't persist across subsequent frames. This is a safe trick
|
|
||||||
// in screen space.
|
|
||||||
|
|
||||||
export default (regl, config, inputs) => {
|
|
||||||
const output = makePassFBO(regl);
|
|
||||||
|
|
||||||
const PALETTE_SIZE = 2048;
|
const PALETTE_SIZE = 2048;
|
||||||
const paletteColors = Array(PALETTE_SIZE);
|
const paletteColors = Array(PALETTE_SIZE);
|
||||||
const sortedEntries = config.paletteEntries
|
const sortedEntries = entries
|
||||||
.slice()
|
.slice()
|
||||||
.sort((e1, e2) => e1.at - e2.at)
|
.sort((e1, e2) => e1.at - e2.at)
|
||||||
.map(entry => ({
|
.map(entry => ({
|
||||||
@@ -41,10 +33,21 @@ export default (regl, config, inputs) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const palette = make1DTexture(
|
return make1DTexture(
|
||||||
regl,
|
regl,
|
||||||
paletteColors.flat().map(i => i * 0xff)
|
paletteColors.flat().map(i => i * 0xff)
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// The rendered texture's values are mapped to colors in a palette texture.
|
||||||
|
// A little noise is introduced, to hide the banding that appears
|
||||||
|
// in subtle gradients. The noise is also time-driven, so its grain
|
||||||
|
// won't persist across subsequent frames. This is a safe trick
|
||||||
|
// in screen space.
|
||||||
|
|
||||||
|
export default (regl, config, inputs) => {
|
||||||
|
const output = makePassFBO(regl);
|
||||||
|
const palette = makePalette(regl, config.paletteEntries);
|
||||||
|
|
||||||
return makePass(
|
return makePass(
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user