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

Image tiling performance improvements and device support #226

Open
oscarlorentzon opened this issue Jan 19, 2017 · 2 comments
Open

Image tiling performance improvements and device support #226

oscarlorentzon opened this issue Jan 19, 2017 · 2 comments

Comments

@oscarlorentzon
Copy link
Member

The current implementation of image tiling is creating a texture with the size of the original image. This is memory inefficient for large images, e.g. panoramas with sizes up to 16384 x 8192 px, and causes long rendering times leaving the viewer unresponsive for up to hundreds of milliseconds from time to time. On devices where the WebGL max texture size is smaller than the original image size the texture will just be scaled and it will not be possible to view the full resolution even when zooming.

The idea with this issue is to only create a texture with the amount of pixels that is needed for the current viewport size. That reduces the memory requirements, the WebGL max texture size will not be a limiting factor, the rendering speed will be improved, and the viewer should behave more smoothly when panning/tilting/zooming.

@oscarlorentzon oscarlorentzon self-assigned this Jan 19, 2017
@oscarlorentzon oscarlorentzon changed the title Image tiling performance improvements device support Image tiling performance improvements and device support Jun 7, 2021
@JakeSmarter
Copy link

JakeSmarter commented Feb 10, 2024

Interestingly enough, I have also stumbled upon this and it causes real issues on some hardware, not just performance but breaks functionality. You cannot zoom in fully if GL_MAX_TEXTURE_SIZE is smaller than an image in one dimension. So, maybe it is about time to fix it. 😉
See here:

Zoom levelGL_MAX_TEXTURE_SIZE
2163844096
GL_MAX_TEXTURE_SIZE == 16384 GL_MAX_TEXTURE_SIZE == 4096

@JakeSmarter
Copy link

JakeSmarter commented Feb 10, 2024

The idea with this issue is to only create a texture with the amount of pixels that is needed for the current viewport size.

For what it’s worth; sure, you can do this but it is complicated to compute the size, shape, and texture coordinates of the needed texture, especially when dealing with multiple projections. And, what do you do if the viewport is larger than GL_MAX_TEXTURE_SIZE? Imho the simplest way would be to just split the image either evenly or unevenly over multiple textures and always render all textures, even those not in view. It may not be as performant as rendering only one texture but you would not need to create a texture for every frame when animating (zooming in/out), unless you intend to create the texture only after animation has stopped. Besides, since OpenGL ES 2.0, all hardware renderers are very good at rendering of at least 8 or more textures in series and in parallel (you just have to bind to all texture units). And, most older renders can deal with multiple parallel textures just fine too.

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