A new technique for approximating the averaged texels for a polygon over a surface.
Visit https://andrewlowndes.github.io/texture-filtering/dist/ to see a set of demos showing the various techniques used in this repo.
- Ensure NodeJS installed
- Run
npm i
to install dependencies - Run
npm start
to open the demos in a web app
- Summed area tables
- Image lookup (CPU)
- Fast blur (CPU)
- Fast blur (GPU)
- Triangle coverage
- Exact triangle coverage (CPU)
- Generator
- CPU - JS (Slow)
- CPU - Rust (Still slow for high resolutions)
- GPU - WebGL (Fast)
- Approximated triangle fitting (CPU)
- Triangle summed area tables
- Generator - WebGL
- Approximated triangle fitting (CPU)
- Mipmap 3D comparison
- A grid is overlaid onto a texture at a specified resolution
- Every combination for each vertex for a line is specified for each coordinate on the grid
- A triangle is formed from each line with the coordinate at (0, 0)
- The accumulative area under each triangle is calculated
- The triangle is rasterised
- The colour of pixel fully covered within the triangle is added
- The boundary pixels are intersected with the triangle and the colour of the pixel is divided by the area of the new shape
- The accumulated colour is divided by the area of the triangle
- Each triangle colour is store in a texture coordinate
Looking up a triangles averaged colour:
- A polygon on the texture surface in 2D is broken down into it's lines
- The line is looked up in the triangle summed area map to give the area for the line
- Each line area is added or subtracted based on the direction of the line
- The total area is then divided by the area of the triangle to give the average colour over the triangle
- Render textures in 3D space, where a multiple texels covers a pixel - alternative to mipmapping/anisotropic filtering.
- Generalise to work with vector graphics
- Global illumination
Install VS Code and the following extensions:
- EditorConfig for VS Code
- ESLint
- Prettier