Archived

This topic is now archived and is closed to further replies.

Streaming in textures like GTA III

This topic is 4950 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I''m trying to stream in textures in real-time as the player moves around a huge map (just like how GTA 3 did). I could stream the textures in from disk in real-time, but that would be slow, so I need to somehow load ALL my textures into system memory first, and then call D3DXCreateTexture to get Direct3D to push the texture into video memory whenever it is about to be displayed. I''ve looked through a lot of docs, and they''re about 2 ways to do it : 1) Use D3DXLoadSurfaceFromFile to pre-load all my DXT5 images from disk into a surface in system memory (1 surface for 1 image), and then everytime a particular image needs to be displayed, I just load the right surface into a Direct3D texture object.... 2) Preload all DXT5 from disk into system memory, keeping them as DXT5 files IN SYSTEM MEMORY, and then calling D3DXCreateTextureFromFileInMemory everytime I need to display that image Now in method 1, I''m guessing it would be faster? since the surfaces are already containing decompressed DXT5 images, and Direct3D wouldn''t have to decompress it in realtime while the game was running ,but the tradeoff is that I would basically have a lot of surfaces in system memory. (1 for each image) While in method 2, I would be able to save space in system memory (since I''m keeping my images in memory as compressed DXT5 files) but there would be the overhead of Direct3D needing to decompress the DXT5 file from memory everytime the image is used. Which is the better way through this? Will appreciate any and all help Regards, Eddie 00000100-00100011-10000000

Share this post


Link to post
Share on other sites
Most hardware nowadays can handle the compressed surfaces directly, without app having to decompress them manually.
This has the massive advantages of bandwith saving and reduced video memory requirements.

Recommended over the two methods you mention, unless there is a specific reason why you cannot use DXT:s directly (ancient hardware comes to mind).

-Nik

Share this post


Link to post
Share on other sites
Hello Nik
Thanks for the reply, but it still doesn''t answer the question : "How should I keep my textures in system memory? Should I store them as Surfaces or in-memory DXT files?

Since my game world is pretty huge (think GTA3), I would definitely need a way of ''precaching'' these textures in system memory.. Everything wouldn''t be able to fit into video mem all at once. It needs to be streamed in as needed.

Will appreciate any help,
Thanks again
Regards,
Eddie

00000100-00100011-10000000

Share this post


Link to post
Share on other sites
Probably best to recycle textures as well. If most are the same size, it would probably be better to swap them rather than deleting and allocating video memory.

Just a guess, but I would think so.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Theres no reason you can''t read them off the disc in real time. Threading is great for this kind of thing.

Share this post


Link to post
Share on other sites