Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Model textures and memory usage.

Author
Message
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Aug 2009 01:57
I want two models to share half of the same texture which is quite easy to do. I was just wondering if DB will load the same texture twice, or will it realise that I already have the texture in memory when the first model was loaded. Or maybe the best way is to rename the texture so that the texture isn't found for either model, and then texture the models using the texture command.

Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 17th Aug 2009 02:04
Quote: "Or maybe the best way is to rename the texture so that the texture isn't found for either model, and then texture the models using the texture command."


if i get what your saying then, yeah.


Er........i dont think DB cares if you have it in memory already.....it'll just load it and treat it the same as any other image. but if you try to load it in the same image number, DB'll flip out, i think........

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Aug 2009 06:02
Well Yeah DB might not care, but I think that two textures are slower than 1 texture, at least they use up memory, and I don't like to waste memory.

Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 17th Aug 2009 18:46
Quote: "I don't like to waste memory."


Yeah, no one does(except my bro). I did find tho that db will acually overwrite the image if you load somthing into the same image number......but it wont crash...

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 18th Aug 2009 00:42
@Pincho

If I recall my DirectX correctly (no guarantees !) , if you have a model or a scene that's made up of several meshes and textures that are all contained in the same X file, if the texture is assigned to multiple meshes, it is only loaded once into memory even if it is assigned to different materials for different meshes.

But, if you have two separate X files, each holding the same texture name, I'm not sure if the texture is only loaded once.

To be sure not to load the texture twice, you could use your idea:
Quote: "Or maybe the best way is to rename the texture so that the texture isn't found for either model, and then texture the models using the texture command."


Or, build the X file with both models in it. This could be limiting if they are not meant to be static like in a scene, but you could set each one up with a set of limbs and animate both in your 3d program.

By static I mean, you could build an entire forest of many trees (that never move) and only use the same set of textures for all of them built into the X file. Even if the textures were reference 100 times, they would only be loaded once by direct x.

Enjoy your day.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 18th Aug 2009 04:23
Thanks! Everything seems to load in DB OK sharing textures, although it got confusing, and I nearly saved over the wrong textures at times.

Login to post a reply

Server time is: 2024-05-09 03:28:09
Your offset time is: 2024-05-09 03:28:09