I created a nodejs app to process and upload an image at runtime to applied to a model as a texture, in order to do this I’m using the followings endpoints of Threekit API:
/api/files – upload the image (time 0.365 seg)
/api/asset-jobs/import – Create a new texture asset (time 8.554 seg)
/api/assets? – Get the assetID just created (time 0.229 seg)
/api/configurations – set the configuration to the model with the new asset. (time 0.45 seg)
Everything is working fine, but the process is taking around 8 seg to complete, analizating this process I realize that the endpoint to take more time is /api/asset-jobs/import (this is beacause I’m wainting to the job completes for I can continue with the process) Is there a way to opitimize this call?
Am I correct in assuming the purpose of this app is to allow users to upload images that will be ultimately applied to a model/material as a texture file?
Threekit has a built-in image upload feature that can do this. You will have to create a configurable material, create an attribute that can take in textures, and then set-up the logic. It is detailed in the docs I linked to you.
If you are not using Threekit’s configuration form, there will have to be some development but I think you will achieve better performance with a configurable material, uploading the image to Threekit, and then providing the assetId of the new texture to your configurator.
If you need more robust examples of how this can be achieved I will write something up for you, let me know!
Hi Will, yes this is to upload images at runtime, but in my case we are not using the player that’s why I 'm creating the asset using the API. Do you know what is the average time that the endpoint /api/asset-jobs/import delay?
I see - in this case yes, this is the most effective way to upload files via API. If the player was involved there would be some ways we could help speed it up. Can I ask what your app does so I can have some context?
sure! our client wants to implement only the AR button on their website without a preview on the player. Besides the user select the image to apply as texture on the model at runtime. This is why we are using the API.