Jump to content

Cache loading textures by file location


martyj
 Share

Recommended Posts

I have a few models that use the same texture. When loading my map I noticed that it loads the same textures over in over instead of using a copy of the texture already loaded from a previous model load.

 

Could there be a cache to not have to reload textures in the same path?

 

Thanks,

Marty

  • Upvote 1
Link to comment
Share on other sites

@martyj I know the logs say it's loading the texture but if the texture is already loaded into memory LE knows to not reload it from disk but to use the one that's already loaded. However, the side effect to this is that if you modify that texture during run-time ALL the models will see that modification since they are using the same instance of the texture which may not be what you want. There are various ways around that though now if you do want that functionality.

 

The way you can tell this is happening is dynamically loading a texture during run-time that was already loaded at startup. It's basically instant and your game doesn't pause (or you don't notice it anyway) which tells you it's not going to disk but just using the existing loaded texture.

 

This is how you can sort of "load" stuff dynamically in your game to create a huge world. You can preload every base asset you'd need and then dynamically cycle through the models you want to load on the fly during run-time 1 every couple frames and you won't notice a slowdown in the game because it's using instances. If you were to go the route of a very dynamic game.

 

That was probably more than you wanted but I was on a roll tongue.png

  • Upvote 1
Link to comment
Share on other sites

There's a flag to disable the auto-cache when you load any asset:

Asset.Unmanaged

 

The engine should only print "Loading texture blah blah blah..." when it is really being loaded. If all instances of it get deleted, for example, it will be reloaded from disc next time it is needed.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...