Unfocused
- group .........
- 3D and WebGL scenes
- source ........
- https://ui.aryank.space/components/unfocused
- markdown ......
- /lab/unfocused.md
- human .........
- /lab/unfocused
── WHAT_IT_IS ────────────────────────────────────────────────────────────────────────────────
An image or video under a directional lens blur that ramps from sharp at one edge to heavy blur at the other, with red and blue split apart and a fixed grain in the shadows. On mount the blur, grain and distortion run to zero over two seconds, so the picture pulls into focus. One WebGL fragment shader, no dependencies.
── BEHAVIOUR ────────────────────────────────────────────────────────────────────────────────
* The grain hashes the pixel position
Each pixel jitters its 24 disc samples with a sine hash of its uv, so the blur reads as grain rather than a smooth gaussian. The hash is sensitive to the last bits of uv, which is why the plane, camera and index order follow the source's OGL scene.
* Rests a hair short of focus
Like the source, the loop stops on the frame the focus pull completes without drawing it. The resting frame keeps a blur of about 0.03 at 60Hz, which reads as sharp.
* Media needs CORS
The image or video is uploaded as a WebGL texture, so it must be same-origin or served with CORS headers. Images get mipmaps; video frames upload every frame while playing.