Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mipmap generation for WebGPU 2D textures #5275

Merged
merged 9 commits into from
Apr 28, 2023
Merged

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Apr 26, 2023

  • WebgpuMipmapRenderer implementation, which uses render passes to render from top to lower mipmap levels.
  • Mipmaps are generated on WebGPU if rendering to a render target with mipmaps, for loaded png/jpg textures, and for color buffer grab pass. Only 2D textures for now, now cube/volume textures.
  • moved deprecated Texture.autoMipmap to deprecated.js

Changea to the texture loading flow:

  • Original flow: load texture with default settings (mip, filtering ...), then use associated asset meta data to apply override settings.
  • New flow: extract override settings and pass them to .Open function which creates the texture resource, to allow texture to be created without the need to override later.
    Background: WebGPU creates texture immediatelly, instead of on first use, and it would have to handle texture re-creation.
    Limitation: WebGPU does not currently allow texture.mipmaps to be changed after the creation. Subject to discussion / change / further work.

Other changes:

  • [Fix] area light LUT texture no longer generates mipmaps (those were unused anywys)

References:

@toji for WebGPU Textures - best practices: https://toji.dev/webgpu-best-practices/img-textures#generating-mipmaps

Result - textures no longer shimmer

mipmaps.mov

@mvaligursky mvaligursky self-assigned this Apr 26, 2023
@mvaligursky mvaligursky added the area: graphics Graphics related issue label Apr 26, 2023
@mvaligursky mvaligursky mentioned this pull request Apr 26, 2023
@mvaligursky mvaligursky requested a review from slimbuck April 27, 2023 14:55
mvaligursky and others added 2 commits April 28, 2023 10:39
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Martin Valigursky and others added 2 commits April 28, 2023 10:44
Co-authored-by: Will Eastcott <will@playcanvas.com>
@mvaligursky mvaligursky merged commit 803f77b into main Apr 28, 2023
@mvaligursky mvaligursky deleted the mv-webgpu-mipmaps branch April 28, 2023 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants