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

Fix/improve image loading #729

Merged

Conversation

eeropomell
Copy link
Contributor

This is a follow up from #722. The goal is to improve the image loading error functionality and figure out the correct size limits for Quest.

The first improvement makes sure that for images that have too large dimensions, the correct error message "Image too large to load" will be displayed in all cases. Previously, it was only working for images that have too large of a file size.

…a-foundation#688)

This is an improvement from the 2 previous attempts (commits) at fixing
issue icosa-foundation#688 because it modifies the original logic way less. We just make
ResetState() call RefreshDescription() every time.

However, this version still has atleast one problem:
- an image can have an error for other reasons too, not just for being
too large. We're currently checking if the image has *any* error. (I
think we need to create a way to check for image size error?)
…load error-specific message

- Add a new entry to the ImageState enum for the error where an image is
  too large to load (ErrorImageTooLarge)

- Only 2 error messages right now: a generic one "Image failed to
  load" and for images that are too large "Image too large to load"

- Move ImageErrorExtraDescription() from LoadReferenceImageButton.cs
  into ReferenceImage.cs, because it needs access to the error
  states.
Not needed anymore as ResetState() sets the button unavailable if the image is invalid
@eeropomell
Copy link
Contributor Author

In the original issue #688 @andybak mentions:

Check to see if our limits for the Quest still make sense.

I'd like some clarification on this. Some questions:

  • Do we consider Quest 1,2,3 all separately?

  • Do we only want to figure out "What dimensions/filesize will crash the game on quest instantly?"

    • Or also do we want to like start showing the error if the memory limit is exceeded? e.g if someone loads 200 images and memory starts to fill up, do we start showing "Image failed to load" or something like that?

These are the current values for Quest:

  ReferenceImagesMaxFileSize: 10485760
  ReferenceImagesMaxDimension: 4352
  ReferenceImagesResizeDimension: 1024

So ~10MB is the max file size and 4352*4352 is the max amount of pixels. I have tested with 16k res images on Quest 3 and I'm not crashing, and the memory limit OB displays increases only by like 1/50?

Reverting to get back to the original limits for now. Still need to figure out if we can increase the limits.
@andybak
Copy link
Contributor

andybak commented Jun 24, 2024

Do we consider Quest 1,2,3 all separately?

I thinks so - they have quite different memory limits (Quest 1 especially)

Do we only want to figure out "What dimensions/filesize will crash the game on quest instantly?" Or also do we want to like start showing the error if the memory limit is exceeded?

It's a tough one and I'm not sure to be honest. It's one of the reasons I never started on this myself. I'd probably say we want to protect the user from getting into a state they can't easily get out of. Does undo resolve things if the image is so big it slows everything down? I suspect they would need to quit and restart.

I know our sketch limits are based on very crude heuristics and is easy to fool. We also don't have autosave on the Quest which changes the risk equation somewhat..

I'd also say that I'm happy with any PR that improves the current status quo. We can always iterate.

@eeropomell
Copy link
Contributor Author

@andybak the current version is mergeable.

It has:

  • improvement to the background image loading: it loads them from the cache now and it's at least 2x faster.
  • same limits
  • if the dimensions are exceeded, then the user will also see "image too large to load", as previously it was only for images with too large of a file size.

Because the LoadImageCache(..) requires the fullpath, not just the name
@mikeage mikeage added the bugfix Something has been fixed label Jun 25, 2024
@andybak andybak changed the title Fix/improve image loading errors Fix/improve image loading Jul 6, 2024
@andybak andybak merged commit 09c7015 into icosa-foundation:main Jul 6, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Something has been fixed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants