Skip to content

Improved mipmap generation #8

Description

@castano

For some background, priorities, and current implementation, see the Runtime Mipmap Generation blog post.

Currently spark allows two choices: a 4x4 magic-kernel-sharp, and a simple box filter. In both cases filtering is done in linear space. Note, the magic kernel is only available in WebGPU and it's not available in Firefox due to Bugzilla issue #1977241.

Also, the magic kernel is avoided when the texture is alpha in favor of an alpha weighted box kernel. The negative lobes in the magic kernel can cause the filtered alpha to be close to 0 or negative, in this causes artifacts when undoing alpha pre-multiplication.

Potential improvements:

  • When alpha is present and is used for opacity, use an alpha weighted average.
  • Support for mipmap alpha scale for coverage preservation.
  • Use a higher quality filter for sharper mipmaps.
  • When the input texture is a normal map renormalize the resulting mipmaps.
  • Tune performance of shared memory convolution.
  • Polyphase filters for non-power-of-two textures.
  • Update the roughness map based on normal length, variance, or toksvig factor.
  • Better quality analysis of various mipmap filtering options.

This issue is aimed at gathering feedback and prioritizing features. More ideas welcomed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions