Forum Replies Created
-
AuthorPosts
-
shantiscriptCustomer
Sorry what do you mean with guess? Is it supported or not?
And if its not supported yet, what is the function of the module file?shantiscriptCustomerYes. I have been working with the integration described in the link for a while now without problems. But i am trying to improve the provided integration by moving to import statements directly in app.js
In the template the verge3D library is imported by using a script tag in index.html
Under step 4.)
<script src="%PUBLIC_URL%/v3d.js"></script>
Instead of that i am trying to import the verge3d modules from v3d.module.js (which should provide verge3d as modules that can be imported) directly in app.js
2020-11-30 at 6:45 am in reply to: Wait to execute function in run code till first frame is rendered #36066shantiscriptCustomerYeah in the puzzles you would create some function, either a while loop that constantly checks if the first frame has been rendered. Or a interval function that checks if the first frame has been rendered.
In code i created a function that first checks if the first frame has been rendered already and if not it runs a check function at an interval of 200ms. The function returns a promise in booth cases
function waitForFirstFrame() { return new Promise(resolve => { if (appInstance.frame >= 1) { resolve() } else { const waitForFirstFrame = setInterval(() => { if (appInstance.frame >= 1) { clearInterval(waitForFirstFrame) resolve() } }, 200) } }) }
you can then run or trigger anything that needs to wait till the first frame has ben rendered in the then() block of that function
waitForFirstFrame().then(runAnimations(animations, { frame: 553, speed: 1 }))
in the example runAnimations will wait till the first frame has been rendered and then start an animation
2020-11-28 at 8:17 am in reply to: Wait to execute function in run code till first frame is rendered #36044shantiscriptCustomerJust an update on this for anyone who might come across this again. There is a better way than using a timeout function to solve this. If the timeout function is too short on a slow device you could still run into running functions before the first frame is actually rendered.
The app instance has a property called framehttps://www.soft8soft.com/docs/api/en/extras/App.html#frame
By checking if the the first app frame has be rendered (for example using an if condition) you can make sure that nothing runs before the first frame has be rendered to the screen
shantiscriptCustomerThanks Yuri for the fast reply
2020-09-03 at 12:29 pm in reply to: Wait to execute function in run code till first frame is rendered #32374shantiscriptCustomerAwesome that worked!
2020-09-03 at 7:36 am in reply to: Wait to execute function in run code till first frame is rendered #32356shantiscriptCustomerHi thanks for the replies!!!
I don’t think you really understand the problem i am running into, so i will try to rephrase.
I disabled auto run in blender for the animation and used the play animation puzzle placed in the main tab as Yuri described.The problem with that is that the animation starts playing the key frames of the animation before the scene is visible to the user (before the first frame of the actual app is rendered to the screen). Means the animation already starts playing in the background while the loading screen is still indicating the loading. So half of the animation has played once the scene is actually visible to the user.
This is because in my understanding the run() method that is called inside of app.loadScene triggers the render of the app instance after the loadScene callback is fired (once the gltf loader has fetched the gltf into the app instance)
But code thats executed in the puzzles or in run() doesn’t wait for the render function to finish but its executed asynchronously right after the run() function has been called. It doesn’t wait for the first render to be finished and there is no callback or promise to wait for that to happen.
So if the render takes longer to execute all animations triggered with the puzzle on start or in run() will already start running in the background// loaded GLTF 2.0 asset var url = 'template.gltf'; // construct a new application with simple rotating preloader var app = new v3d.App('v3d-container', null, new v3d.SimplePreloader({ container: 'v3d-container' })); // load main scene app.loadScene(url, function() { app.enableControls(); app.run(); runCode(); }); function runCode() { // place your own code here }
So i need a way to wait for the animation to start until the first render is completed.
2020-09-02 at 2:58 pm in reply to: Wait to execute function in run code till first frame is rendered #32335shantiscriptCustomerJust to add when using the play animation puzzle in the puzzle editor the same thing happens.
The animation starts playing before the first frame is rendered and half of the animation already happened once the first frame renders.
I can’t use autostart (in Blender export) to trigger the animation as there are some other dependencies in javascript in my project, so i need to start the animation by using javascript/puzzleshantiscriptCustomerhi I allready found an answer myself:
https://stackoverflow.com/questions/16625969/how-do-i-change-the-same-parameter-on-multiple-objects-efficiently-in-blendercopy to selected is the magical command.
Still would be courius about las question. Can i change all settings for export globaly?
shantiscriptCustomerAnother quesiton. Is it possible to change the animation settings globally for the whole export? I want to trigger all animations through code in the end and would like to dissable on all animations on start for export. But have the ability to also turn all of them on easily for the purpose of building and testing
shantiscriptCustomerThanks for the very detailed reply and also for fixing the memory leak of dispose so quickly.
Also the api explanations of dispose and unload are much clearer now. This is very helpful. I want to work on loading models dynamically into scenes and now its clear where and when to use unload instead of dispose.Thanks
shantiscriptCustomerThats fantastic, thanks.
shantiscriptCustomerThanks for the fast response on this, appreciated.
I tried the updated version and all works smoothly now. For the previous problematic scenes render time went down now by 3 to 4 seconds which is fantastic.
Thanks for the improvements madeshantiscriptCustomerHi,
i did load the scenes multiple times in booth versions. So it would have been cached for version 3.3 as well. The difference in loading time with this specific scene is 17 second and stays the same even if i load multiple times. I also tested this with incognito mode, to make sure that there is no cached version yet, and same results
So it can’t be the cache.
There seems to be an issue with the new version using scenes that have larger texture maps. I tried a couple different scenes and the once with smaller texture maps are loading faster while the once with bigger texture maps got worst.
I tried to upload this specific scene (that got 17 seconds slower) to the verge network but the upload is super slow.
So i removed the blender files, zipped the app folder and uploaded it to my gdrive. I created one version with verge 3.3 and one with 3.2.
Can you please have a look and test? As other users have reported slower scenes as well i think there is some problem for specific configurations. Nothing changed between the two apps, i only updated to version 3.3version 3.2:
https://drive.google.com/file/d/18agspUHv3K-WZwEHT9-5qU7of6-zxuf7/view?usp=sharingversion 3.3:
https://drive.google.com/file/d/18AsjQ-Bry2ljIcBqq_sWZmS1HuIx4ljh/view?usp=sharingif you need the blender files as well, please let me know then i will upload them
shantiscriptCustomerAlso Is the missing support for the parallel compiler due to old computing hardware? If so this could be an issue for a lot of people with older computers and older phones? But i guess for these ones you switch back to legacy compilation automatically?
-
AuthorPosts