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

Feature: Textures #2

Open
cszach opened this issue May 21, 2024 · 0 comments
Open

Feature: Textures #2

cszach opened this issue May 21, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@cszach
Copy link
Owner

cszach commented May 21, 2024

Support for textures e.g. albedo maps, height maps, normal maps, etc. would be desirable for the MVP.

Important note: WebGPU does not support bindless textures. This means that drawing textured objects in one pass becomes non-trivial. Possible workarounds:

  1. Use generative WGSL code to have multiple bindings, one for each texture. Need to investigate the limit of bindings in a group and the performance.
  2. Texture atlas: pack textures inside a large texture for lookup at runtime.
  3. Use texture_2d_array, but all textures must be the same size.

Texture atlas

The best out of all seems to be using a texture atlas, as it is a common software solution, a well-researched problem, and allows (conceptually) an arbitrary number of textures with arbitrary sizes.

The problem of generating a texture atlas is that of 2D rectangular bin packing. However, we would like to consider the dynamic version of it whenever possible, where a texture might be added or destroyed on the fly, and the texture atlas must react correspondingly. This variant of the problem is 2D rectangular bin packing with predefined gaps, or dynamic bin packing (?).

Helpful resources

@cszach cszach added the enhancement New feature or request label May 21, 2024
@cszach cszach added this to the First Public Release milestone May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant