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

enable to choose samplers (nearest and linear) at a Kage program #2962

Open
11 tasks
hajimehoshi opened this issue Apr 14, 2024 · 4 comments
Open
11 tasks

enable to choose samplers (nearest and linear) at a Kage program #2962

hajimehoshi opened this issue Apr 14, 2024 · 4 comments

Comments

@hajimehoshi
Copy link
Owner

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • OpenBSD
  • Android
  • iOS
  • Nintendo Switch
  • PlayStation 5
  • Xbox
  • Web Browsers

What feature would you like to be added?

Now Kage doesn't provide a linear sampler and a user has to do their own linear interpolation. This is troublesome. We want an option to specify a sampler.

Why is this needed?

A linear fileter is useful (e.g. implementing a SDF font).

@hajimehoshi hajimehoshi added this to the v2.8.0 milestone Apr 14, 2024
@hajimehoshi hajimehoshi changed the title enable to choose samplers (nearest vs linear) enable to choose samplers (nearest and linear) at a Kage program Apr 14, 2024
@hajimehoshi
Copy link
Owner Author

Hmm, this might not match well with the current pixel mode, where an integer position is specified.

Other notes:

OpenGL: there is no way to choose a sampler in GLSL programatically. This is bound to a texture by glTexParameteri. As of OpenGL 3.3, a sampler object is available.
DirectX: A sampler can be chosen in HLSL?
Metal: A sampler can be chosen in MSL.

@hajimehoshi
Copy link
Owner Author

So, "why not both"? We can have funcitons to get a texel data without interpolations (like texelFetch) and with interpolations (like texture2D)?

@Zyko0
Copy link
Contributor

Zyko0 commented Apr 17, 2024

Just my opinion, but I don't think it's necessary, and I couldn't imagine a clean way to integrate the notion of samplers in ebitengine/kage.
Also, linear sampler is one example, but there are many different filtering techniques, so when should we stop? (linear, bilinear, trilinear, etc...)
I would rather write an example implementation in Kage, or (what this issue aims for) wait for other user inputs 😅

@hajimehoshi
Copy link
Owner Author

hajimehoshi commented Apr 17, 2024

Thanks,

Also, linear sampler is one example, but there are many different filtering techniques, so when should we stop? (linear, bilinear, trilinear, etc...)

IIUC nearest and linear are the two common preset filter in various libraries/GPU. There are no other such filters

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

No branches or pull requests

2 participants