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 sampling for textures #10

Closed
jsulpis opened this issue Oct 13, 2023 · 2 comments
Closed

Mipmap sampling for textures #10

jsulpis opened this issue Oct 13, 2023 · 2 comments

Comments

@jsulpis
Copy link
Contributor

jsulpis commented Oct 13, 2023

Hello,

I am getting some artifacts when using Texture uniforms, which I think are due to the lack of mipmaps for the textures. I see that the Filter option only accepts nearest and linear, but no mipmaps.

Do you have any plan on implementing mipmaps ? Or do you have a workaround ? I could load the textures on the GPU using directly the native WebGL API, but then since I don't have access to the program, I don't know how to bind them to the uniforms.

Thank you !

@CodyJasonBennett
Copy link
Owner

I've refrained from adding mipmaps since it introduces an asymmetrical API between WebGL and WebGPU since the latter does not implement it natively (instead, you're expected to implement it yourself).

WebGPU gives better tools for this though, and although I first implemented this library to show how similar you can design WebGL2/WebGPU, I can allow such a common case for WebGL.

For future reference, if you find yourself wanting low-level access to renderer state, refer to mangled internals as follows:

four/vite.config.ts

Lines 4 to 14 in 7c50eae

const mangleMap: Record<string, string> = {
_compiled: '_c',
_programs: '_p',
_geometry: '_g',
_buffers: '_b',
_textures: '_t',
_samplers: '_s',
_FBOs: '_f',
_UBOs: '_u',
_pipelines: '_p',
}

@CodyJasonBennett
Copy link
Owner

Released in v0.3.0 under Sampler.generateMipmaps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants