[Notice of Holidays]
Please note that our staff will not be available from 2024/Dec/28 - 2025/Jan/5 JST.
The Live2D Creators Forum will remain open during the holidays.
Submissions that require a response will be answered after we reopen for business.
Please note that it will take longer than usual to respond to your request.
How to load in textures dynamically at runtime for web
Hello, I'm trying to create a character creator where a user can customize their avatar with hundreds of traits on a web page. because there's so many traits, I only want the browser to load in the texture files of the trait that I am selecting at runtime (otherwise the browser would need to load in hundreds of traits which takes too much bandwidth). Is there a way to do this? Thank you
0 ·
Comments
for example in this youtube video, you can select what clothing trait the avatar is wearing, but i will have hundreds of clothing traits
https://youtu.be/kDh9SH6GRgc?si=UbutMeXNKScGqF7t&t=512
so for example only after the user selects the leather jacket trait, I want the browser to load in the leather jacket pngs. otherwise it is too many assets for the browser to load in
Thanks for using our products.
The Cubism SDKforWeb Sample loads textures only once when loading a model at the following locations.
https://github.com/Live2D/CubismWebSamples/blob/develop/Samples/TypeScript/Demo/src/lappmodel.ts#L438-L483
We think we can switch textures by calling these processes dynamically.
Note, however, that it is necessary to separately manage which texture file contains a particular part texture, and there is no functionality in the Cubism Editor or Cubism SDK to support this.
Best regards.
Thanks for your response! Now I'm realizing it's not just as simple as just changing texture, because different clothing traits can have different animations and meshes. Do you have any recommendations on how to handle that? The concern is also that there may be hundreds of different animations and meshes for clothing.
Dynamic switching of clothing and other parts is not impossible, but considering that "The concern is also that there may be hundreds of different animations and meshes for clothing," it is difficult to handle everything on the SDK side.
An alternative is to create multiple models for each theme and use them as the basis for switching the clothes to be displayed. However, this may not meet the requirements because the models themselves will have to be switched and parts cannot be used interchangeably between models.
Therefore, even if it could be implemented in a situation where "there may be hundreds of different animations and meshes for clothing," it is not recommended because it would be too costly operationally.
Best regards.