# Image loading need improvement

**URL:** <https://ask.vrchat.com/t/image-loading-need-improvement/28357>\
**Category:** General Discussion\
**Tags:** world\
**Created:** [November 30, 2024, 2:41am UTC](https://ask.vrchat.com/t/image-loading-need-improvement/28357 "2024-11-30T02:41:44Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeadMoon](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@DeadMoon](https://ask.vrchat.com/u/DeadMoon)\
**Post date:** [November 30, 2024, 2:41am UTC](https://ask.vrchat.com/t/image-loading-need-improvement/28357/1 "2024-11-30T02:41:44Z")

</div>

The Image Loading restriction is too strict for a dynamically updated Gallery System.

It has been found that there has been a discussion about this in the feedback but it has been long shelved.

A relatively possible approach would be to generate thumbnails via Video Player, however after some experimentation it was found that the API behavior was extremely system and platform dependent.

There was no guarantee of consistent behavior, not only was the API complex and difficult to debug, but the code for the Unity related discussions was actually difficult to track down the cause of the problem, and ultimately it was found that synchronization could not be effectively controlled.

Some magical values and tricks had to be applied to make it work, but absolute reliability could not be guaranteed.

What’s worse is that Udon repackages it and lacks exposure to the original built-in functions, which makes it even harder to control.

Even if it works fine in C#, there is no guarantee that it will work effectively ported to Udon, and there are small details that the lack of API exposure will make the final operation more complicated.

Additionally, you need to convert a large number of images into a single Video each time through the software, and you have to circumvent the rate limit of five seconds for this to happen… Controlled decoding and copying of textures is accomplished in the process.

I’ve basically experimented with some of the programs I could find on Unity itself, and confirmed the uncontrollability of functions like frameReady to Graphics.CopyTexture.

CopyTexture, etc. Worse yet, Blit is even more uncontrollable than CopyTexture…

* * *

Since checking whether two textures match in pixel content is far beyond Udon’s ability, it can only be implemented that when a texture copy event occurs, the behavior of an empty loop must be performed continuously on subsequent frames until a certain level of copying is performed on the next frame.

In addition, can you specify the frame? Videoplayer related functions do not expose the frame, the controllability is extremely low…

* * *

I know there are simpler ways to do this, for example Videoplayer has an available decoder built into the system for H.264 format, up to 4096\*4096 with hardware acceleration.

H.265/AV1 can have 8192\*8192, but I’m sorry if the user can’t see it without installing it on the system from the Microsoft Store.

Splitting is done via a simple Shader, but there is an upper limit to the sharpness, or multiple images need to be weighed.  
This means that there are reasonable combinations of 8192_2048 or 16384_1024, or a variety of other combinations, but this implies some kind of limitation.

* * *

You can solve it directly through UnWrap Mesh UV without writing a shader…

---

<div class="post-metadata">

**Author:** ![docteh](https://yyz1.discourse-cdn.com/vrchat/user_avatar/ask.vrchat.com/docteh/32/12171_2.png) [@docteh](https://ask.vrchat.com/u/docteh)\
**Post date:** [November 30, 2024, 8:19am UTC](https://ask.vrchat.com/t/image-loading-need-improvement/28357/2 "2024-11-30T08:19:02Z")

</div>

Can you do the thumbnail first as an image? Then replace with the proper images as they load?

As the images are raw texture format I believe they should be used sparingly. Like it’s 12mb for 2k RGB. How many of those are you going to load for a gallery?

---

<div class="post-metadata">

**Author:** ![DeadMoon](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@DeadMoon](https://ask.vrchat.com/u/DeadMoon)\
**Post date:** [November 30, 2024, 8:36am UTC](https://ask.vrchat.com/t/image-loading-need-improvement/28357/3 "2024-11-30T08:36:49Z")

</div>

Dozens and hopefully it’s clear enough

Five seconds of gradual replacement is too slow

---

<div class="post-metadata">

**Author:** ![docteh](https://yyz1.discourse-cdn.com/vrchat/user_avatar/ask.vrchat.com/docteh/32/12171_2.png) [@docteh](https://ask.vrchat.com/u/docteh)\
**Post date:** [November 30, 2024, 6:20pm UTC](https://ask.vrchat.com/t/image-loading-need-improvement/28357/4 "2024-11-30T18:20:19Z")

</div>

Dozens? How many images need to be full quality at one time? Maybe use image loader for a further away lod and then use a video player for the closeup. I’ve seen a few worlds do like a slideshow function by controlling a video player with 1 second granularity. Also seen a video player with a few options like 1 5 10 seconds.

Make sure your video keyframes line up with the images.

Personally I think a website would be better to look at a changing set of images, rather than a VRChat world

---

<div class="post-metadata">

**Author:** ![DeadMoon](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@DeadMoon](https://ask.vrchat.com/u/DeadMoon)\
**Post date:** [November 30, 2024, 7:14pm UTC](https://ask.vrchat.com/t/image-loading-need-improvement/28357/5 "2024-11-30T19:14:38Z")

</div>

The main expectation is that it is easy to use and maintain, avoiding additional costs that may be incurred later.

Embedded into the world is usually used as an advertisement wall and a simple and easy to expand gallery, managed through the backend and decoupled from VRchat, avoiding repeated uploads to update the world and scrubbing the player’s cache.

The larger the world, the more it needs

---

<div class="post-metadata">

**Author:** ![thelvaen](https://yyz1.discourse-cdn.com/vrchat/user_avatar/ask.vrchat.com/thelvaen/32/13935_2.png) [@thelvaen](https://ask.vrchat.com/u/thelvaen)\
**Post date:** [December 4, 2024, 4:56pm UTC](https://ask.vrchat.com/t/image-loading-need-improvement/28357/6 "2024-12-04T16:56:09Z")

</div>

you can download up to 100MB on the text file format, so you probably can have Base64 encoded image in a text file, loading multiple images at once. You just need to decode them from the file.

> **[String Loading | VRChat Creation](https://creators.vrchat.com/worlds/udon/string-loading/)**
>
> String Loading allows you to download text files from the internet and use them in your VRChat world. You can either use the DownloadString script included in the SDK, or you can make your own script using the new VRCStringDownloader.LoadUrl...

---

<div class="post-metadata">

**Author:** ![DeadMoon](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@DeadMoon](https://ask.vrchat.com/u/DeadMoon)\
**Post date:** [December 4, 2024, 4:58pm UTC](https://ask.vrchat.com/t/image-loading-need-improvement/28357/7 "2024-12-04T16:58:17Z")

</div>

Have you considered Udon’s performance…

How much does it cost you in terms of performance to decode webp these?

---

<div class="post-metadata">

**Author:** ![thelvaen](https://yyz1.discourse-cdn.com/vrchat/user_avatar/ask.vrchat.com/thelvaen/32/13935_2.png) [@thelvaen](https://ask.vrchat.com/u/thelvaen)\
**Post date:** [December 4, 2024, 5:00pm UTC](https://ask.vrchat.com/t/image-loading-need-improvement/28357/8 "2024-12-04T17:00:55Z")

</div>

it’s gonna be a couple of calls per image, creating object, and copying it from the JSON, not the worse in terms of performances.

```auto
    byte[] imageBytes = Convert.FromBase64String(str);
    Texture2D tex = new Texture2D(2, 2);
    tex.LoadImage( imageBytes );

```

---

<div class="post-metadata">

**Author:** ![thelvaen](https://yyz1.discourse-cdn.com/vrchat/user_avatar/ask.vrchat.com/thelvaen/32/13935_2.png) [@thelvaen](https://ask.vrchat.com/u/thelvaen)\
**Post date:** [December 4, 2024, 5:06pm UTC](https://ask.vrchat.com/t/image-loading-need-improvement/28357/9 "2024-12-04T17:06:48Z")

</div>

I won’t deny it needs improvements, I’m just saying, there’s solution to your Gallery System with the existing features without relying on video players.

I remember when people were storing strings in Avatars profile picture (using some encoding), because the video stream was too unreliable to be used that way.

---

<div class="post-metadata">

**Author:** ![DeadMoon](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@DeadMoon](https://ask.vrchat.com/u/DeadMoon)\
**Post date:** [December 4, 2024, 5:11pm UTC](https://ask.vrchat.com/t/image-loading-need-improvement/28357/10 "2024-12-04T17:11:20Z")

</div>

I may have to look into writing a backend and experiment with it…

However, the performance of similar APIs is not very good, and will be degraded again in Udon.

I hope Udon will give less restrictions and more flexible API…

---

<div class="post-metadata">

**Author:** ![DeadMoon](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@DeadMoon](https://ask.vrchat.com/u/DeadMoon)\
**Post date:** [December 4, 2024, 11:18pm UTC](https://ask.vrchat.com/t/image-loading-need-improvement/28357/11 "2024-12-04T23:18:29Z")

</div>

Have you ever actually written in Udon?

LoadImage is not exposed in Udon.

The version is 3.7.4

---

<div class="post-metadata">

**Author:** ![thelvaen](https://yyz1.discourse-cdn.com/vrchat/user_avatar/ask.vrchat.com/thelvaen/32/13935_2.png) [@thelvaen](https://ask.vrchat.com/u/thelvaen)\
**Post date:** [December 5, 2024, 7:30am UTC](https://ask.vrchat.com/t/image-loading-need-improvement/28357/12 "2024-12-05T07:30:35Z")

</div>

My bad, I thought it was possible based on the C# equivalent, I’ll admit I didn’t test it myself. That function not being there is indeed a serious limitation.
