Skip to content

What limits the available pixel format for HDR #76

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

Open
hmaarrfk opened this issue Apr 9, 2025 · 2 comments
Open

What limits the available pixel format for HDR #76

hmaarrfk opened this issue Apr 9, 2025 · 2 comments

Comments

@hmaarrfk
Copy link
Contributor

hmaarrfk commented Apr 9, 2025

In https://github.com/pygfx/rendercanvas/pull/75/files I see that

  • rgba-u8
  • rgba-u16
  • rgba-f16
  • rgba-f32

I'm wondering if it would also be possible to add support for

  • rgba-u32
  • rgba-i8
  • rgba-i16
  • rgba-i32

We use i16 sometimes because u16 doesn't seem to be supported by pytorch in many operations.

Exciting that this has come through!

@almarklein
Copy link
Member

Would be nice to improve support on this front, indeed. For now I kept it simple. Here are some thoughts ...

A fragment shader normally produces an rgba color with values 0..1.

  • The rgba-u8 format maps to rgba8unorm, where norm means normalized to 0..1.
  • I added rgba-f16 and tested it with an example. Since this is a float, it accepts pixel values 0..1 too.
  • I also added rgba-f32. I'm pretty sure one needs to enable a wgpu feature to be able to use this. In any case I have not tried it yet. But if it does work, it's float, so 0..1.
  • I also added rgba-u16, but I'm not sure how that works out to be honest. Should the fragment shader now produce values 0..65535?
  • Same for the other integer formats.

@hmaarrfk
Copy link
Contributor Author

hmaarrfk commented Apr 9, 2025

Right. One of the challenges with the more extended formats is that often they don’t have normalized forms.

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