how to pre cache the assets during loading the scene


photo

Recommended Posts

Hi,

How to pre cache the assets/objects/material when loading the new scene?  T The goal is when play back the animation or so, it will improve the performance when loading the objects / play animation, it will have minimal impact on FPS.

Link to post

ianyyin

Could you please tell us which SDK version are you currently using? If you are using 2.12.0.2 you can preload all the shaders and materials to RAM via materials_loading_mode 2 option (in boot.config or via engine start up parameter).

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post

Hi Silent, we are using 2.6.1

Link to post

is there similar mechanism in unigine like object pooling in unity or other engine? This way, we can pre-instantiate all the objects we’ll need at any specific moment before the scene is played/live.

Link to post

You can write a small custom logic that will move the camera over your scene to load all the objects into the GPU memory. This will work only if you have meshes + textures + screen gbuffer size smaller that total amount of GPU VRAM available.

You can check an example of this logic implementation in Superposition demo (source/Warming.cpp).

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post

Does this mean that we have to have a camera movement track involved? is there any way to do this during the loading time?

Link to post

You can do it via tracker or simply by moving camera from code. The only purpose of this is to make all the objects to begin load.

Please check the Superposition demo sources, the warming procedure is running and splash screen is displaying at the same time.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post

what if we have some hidden node in the scene, will this work? In this case, we need to show "the hidden" node first, then hide it again to make sure this is pre cached?

Link to post
  • 1 month later...

Hi Silent,

We are able to precache the node like objects, materials. 

What about the particles?For  some particle effects, do you have any suggestions to precache during the loading of the scene?

 

Link to post

You could enable particles in front of the camera during the warm-up process, that should help later when you will enable them.

Other than that, I'm afraid, there is nothing can be done.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post

Hi silent, these proposed workarounds are impractical in most more complex real world scenarios.

Actually the key issue here is a missing feature of the Ressource streaming implementation: it should be possible for every Resourcen (materials/shaders/textures, meshes, skinned meshes/animations,....) to specify streaming behaviour via some per-instance attribute, supporting different resource loading modes like e g. streaming, pre-cache and locked.

Default value for all assets current streaming mode, but for special cases pre-cache (cache up to a certain memory limit, dynamic resource unload allowed) or even locked (always load on startup, never unload)

Code changes should be quite minmal, but would provide great flexibility for customization of engine resource loading.

  • Like 1
Link to post

Ulf,

That's is something we are thinking to implement in the future. Right now async streaming allow us to minimize frame rate drop (it works much better than in the old SDKs).

Allowing more control on streaming and setting to many assets to pre-cached or locked state may increase the amount of crashes due to VRAM limitations, so you need to be very careful in assets selection.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post

Hi Silent, sure, user control also means user responsibility :-)

Link to post