Jump to content
  • Advertisement
  • entries
  • comments
  • views

ZOMG 250.000 views! & Texture Cache/LOD system

Sign in to follow this  


Noiiice, I guess that's some kind of landmark in journal-land?

I wonder who will be the first to get 1,000,000 views :-O

'Tis the season to pimp some sweet new artwork...

Too bad I don't have any great new in-game screens or artwork to show in this post [ just scrooolllll down the last few entries ].


This image of the game's Vulcan Minigun will have to do. Click on the picture to watch the classic Predator scene staring Jesse "Future Gov." Ventura along-side Arnold "Future Governator" Schwartzzeneggeraaaaa;hdddfffff...go on. Click it.

Mini-gun's Model Specs -
1024x1024 Color-map
1024x1024 Normal-map
1024x1024 Specular-map
~8,000 triangles

On a similar note, my characters have > 40MB of texture data each. To load all game textures @ their highest resolution would require ~4GB of RAM.

I devised a Texture LOD / caching system to handle the situation.

Basically, before, I was maintaining 3 directories High/Low/Medium, hand re-sizing the source 2048x2048 character, vehicle, environment, weapons, etc...that was a major pain.

I have come up with a ~250 line solution using windows find structures and the fantastic DevIL library. I esentially have my source 2.5GB directory "LOD1", and use FindFirstFile()/FindNextFile(), DevIL and some ShellExecute() commands. I kick off the process by running the game's .exe with a -Generate_Texture_LOD cmdline parm. It's all done as a pre-process to running/releasing a build, I generate 4 other directories which hold 0.5, 0.25, 0.125, 0.0625 scaled versions of the source texture. It takes about 3-4 minutes to re-size all the textures [ they are mixed, tga, bmp, jpg...some with alpha channel ].

This results in a memory usage of ~2.5GB down to about ~10MB.

@ the start of the game, I un-cache all texutures [ load the LOD5 version, which is trivial and takes 0.01 seconds or similar negligible ]. On-demand in the game I load all needed textures @ the user's selected texture resolution. So only needed textures are loaded into RAM. I also un-cache textures that are unused after X seconds. I could extend it further by using D3DXTEXTURE9::SetLOD() calls [ which would only give me control over the video RAM, it would still be loaded into regular RAM ] and determining the screen size & texel ratio and manage the loaded texture LODs that way.

I also have a hard ceiling on the number of texture loads per frame, so there are now no real "locking load times" that screw up multiplayer on slow machines as the game/netcode loops are never getting hit in that situation.

Anyways it was a pretty basic setup and I'm quite happy with the results, obviously the memory usage has gone down nicely. On average ~200MB in the lower texture resolutions [ 512x512, etc.], which is cool and keeps me <1GB RAM use @ Low, 1.5GB at Medium, and highest is about 4GB of RAM usage [ie: 2048^2 color/normal/specular for everything thing ].

But yea, still cranking on other parts of the game, stay tuned for an update soon with some good stuff.

Happy Holidays & Merry Christmas!

::drunk christmas weekend emoticon::

- Danny
Sign in to follow this  


Recommended Comments

mmm, nothing raises the Christmas spirit like some good 'ol minigun mayhem :)

Share this comment

Link to comment
Original post by johnhattan
ZOMG 250.000 views!


Damn you John Hattan. YUO JUST RUINED MY 250k VICTORY POST.

*shakes fist*

*puts on superman cape*

*gets on segway and drives off*

Share this comment

Link to comment
FWIW, JohnHattan has had a journal longer than a lot of Lounge regulars have been alive. He is what they call 'old timer'. Point and laugh and make fun of his arthritis. Go ahead.

Share this comment

Link to comment

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
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!