Sign in to follow this  
paradoxnj

Texture Management

Recommended Posts

I am currently working on a 3D engine that is using DirectX 9. I've run into a design problem for texture management. The dilemma is: Do we need a generic texture class that loads and manages the textures or can D3DX handle the texture loading and texture management for us? Problem is that we have a 3D editor with a real-time material preview. Some level designers will have over 1000 textures. I'm not sure if it's a wise decision to load 1000 textures and have hardware manage them. We may run out of texture memory. Does anyone know of a better way to manage textures?

Share this post


Link to post
Share on other sites
If you create your textures in the managed pool Direct3D will do all the memory management for you. I mean using system ram as cache and things like set.

But I recommend building a small wrapper class around the Direct3D texture interfaces. This makes it easier to add custom file formats, converting and reporting functions.

Share this post


Link to post
Share on other sites

You need to keep track of the texture objects that you have created. Naturally you can use a reference count system to check whether the texture should be kept in memory or not. 1000 textures might be much if they are of large size, so that kind of management might be useful. Most of the time the artist is just previewing the texture so only thing you do with that texture is show it when needed and then dump away. Somekind of thumbnail system might be good too for an editor.

Share this post


Link to post
Share on other sites
For each resource I have a class that handles the resource as such and then a resource manager class that handles the allocation/loading and rendering of those resources. This has it's advantages such as being able to hook events from your resource manager that will handle the resources when your device is lost and also not having resource duplicates. This saves memory and the other things that go with it.

I hope this helps.
Take care.

Share this post


Link to post
Share on other sites
I use the D3DX library. It's easy to use and well it works for me ;).
Just to add to my previous post. I suggest looking at some kind of streaming (Loading on demand) type setup for you.
You might also want to look into some kind of LOD scheme and low res textures to accompany them. So let's say it's an open landscape you could check the LOD and appropriately match the low res textures. This will ease up on memory and improve performance.

I hope this helps.
Take care.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this