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
Handling large images #360
Comments
Interesting problem! Possible solutions can be divided into two categories: we could put the image into multiple textures and position these such that it looks like a single one, or, we could use a "smart" solution that uploads data dynamically. The former is simpler to achieve, but will only allow larger images up to a certain point, because you'll run into the boundary of available GPU memory. Therefore my inclination is to go for the latter, which scales up to much larger datasets, opening up interesting use-cases. So indeed something like your nr. 3. Perhaps using two textures: one showing a full-scale downsampled version, and one full-res positioned in the visible region.
We don't do anything like this yet, but it's certainly possible. Also see #81. This is, I think, quite a bit of work to do right. So if users need this quickly, we can first implement a stricthing-approach ... |
To clarify this a bit:
|
thanks!
Would there be significant performance benefits to using this rather than the simpler solution of tiling |
I think the performance benefit would be negligible. |
Multiple Image objects approach implemented here, performance and array size is enough for our use cases so far 😄 fastplotlib/fastplotlib#143 |
Did WGPU change the Texture size limit in the latest release? Textures > 8192 in either direction appear to be working now. Tried this on 2 computers and a new environment with from wgpu.gui.auto import WgpuCanvas, run
import pygfx as gfx
import numpy as np
canvas = WgpuCanvas()
renderer = gfx.renderers.WgpuRenderer(canvas)
scene = gfx.Scene()
im = np.random.rand(10_000, 10_000).astype(np.float32)
image = gfx.Image(
gfx.Geometry(grid=gfx.Texture(im, dim=2)),
gfx.ImageBasicMaterial(clim=(0, 1), map=gfx.cm.plasma),
)
scene.add(image)
camera = gfx.OrthographicCamera(10_000, 10_000)
camera.local.position = (5_000, 5_000, 0)
camera.local.scale_y = -1
if __name__ == "__main__":
canvas.request_draw(lambda: renderer.render(scene, camera))
run() EDIT: I can confirm that with
|
These limits are defined by wgpu-native, which takes them from wgpu-types, which seems to query them from the underlying API (Vulkan/Metal/DX12), so it's hard to tell what changed. |
Did you update drivers, or OS, or hardware? |
Currently it is not possible to display images by using a Texture from an array larger than [8192, 8192], which seems to be a WGPU limitation:
I see a few potential ways to get around this:
LargeImage
class that stitches togetherpygfx.Image
pygfx.Image
, use a single grid geometry with tiled textures if that's possible?Is there a better way?
The text was updated successfully, but these errors were encountered: