Home › Forums › General Questions › Initialisation/Preloading all Assets, incl. hidden
- This topic has 7 replies, 3 voices, and was last updated 3 months, 2 weeks ago by
tomtm.
-
AuthorPosts
-
2024-10-31 at 12:39 pm #78351
tomtm
CustomerHi,
what is the best way to pre load all assets? I know, there are some other posts,
but no of this code snippets did push everything in the memory before the app starts.Usually I place everything in the camera view and make things all unhidden and hide again.
But this might be a little “old” school?
Is there a code which would force all shaders to be compiled and objects
be loaded in the memory before the app starts?Greets Tom
2024-10-31 at 2:19 pm #78355kdv
Participantwhich would force all shaders to be compiled
all material shaders are already compiled on loading.
and objects be loaded in the memory
app.scene.traverse(function(obj) { if (obj.isMesh) { if (obj.material.isMeshNodeMaterial) { for (let name in obj.material.nodeTextures) { app.renderer.initTexture(obj.material.nodeTextures[name]); } } app.renderer.updateGeometry(obj); } });
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2024-10-31 at 9:40 pm #78381tomtm
CustomerHi Kdv
Do you put this script in the very beginning of the puzzle?
I still have the situation, that some actions have some frame drops the first time they run.
After playing the animation the second time, it is fine.2024-10-31 at 9:46 pm #78382kdv
Participantwithout your files it’s hard to find out what is the best way to get rid of lags
sometimes that code works fine, sometimes it’s not good enough.
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2024-11-01 at 2:43 am #78383tomtm
CustomerHi
unfortunately due to a NDA I can‘t share the scene.
Maybe I have to many calls when I start an animation, but this wouldn‘t explain, why it‘s working after I called it
one time.Thanks for the script and help!
Tom2024-11-01 at 2:46 am #78384kdv
ParticipantI can‘t share the scene.
then you’re on your own
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2024-11-01 at 2:57 am #78385c4cc
ParticipantI can‘t share the scene.
Might I suggest distorting/messing up the mesh, changing the colors of materials/shaders/procedural effects, etc, to change its physical appearance WHILE RETAINING the original line/vertices count and shader/procedural effect methods the same? That way, the principles of the answer can be derived while anonymity retained.
2024-11-05 at 9:33 am #78448tomtm
CustomerI hope I can post a sample scene soon.
I am really curious how to make initialisation better, especially if you enter VR, there are likely more difficulties due to the nature of weaker hardware. -
AuthorPosts
- You must be logged in to reply to this topic.