Author Topic: idea for oprimising texture usage  (Read 1585 times)

0 Members and 2 Guests are viewing this topic.

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
idea for oprimising texture usage
i started making normal and height maps for nukemod's lower poly ships. the height maps in particular got me thinking. they only need to be grey, and storing them as dxt1, or a8, tends to only give you a 2-1 ratio. so theres not much memory savings gained by using the compressed format. what if we put the height map into the unused glowmap alpha channel. the glow map double in size in size, in the same way we put env in shine alpha. that way we eat up less memory for the 15 or 16 channels it takes to texture a ship theese days, and reducing out usage to just 4 dxt5 maps per texture.

scratch that, actual math says it would be the same to store them in 2 dxt1s as it would to store them in 1 dxt5 :Danyway it still makes textures easyer to manage, sence youre using 4 per ship.
« Last Edit: October 25, 2007, 04:18:20 am by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
Re: idea for oprimising texture usage
Everyone seems to be coming to me with something like this lately, but you are really just wasting your time.  Remember that this has been in the works since last year, and in testing since March.  You also have to remember that without a material system in place the shaders have to be one-size-fits-all.  And all of the content has to work in a way that it's fully compatible whether you use shaders or not.  You also have to deal with the fact that not every ship is going to need/want a normal map, much less a height map.  This isn't a FPS, and you really don't get close enough to see that much detail in the models all that often.  In most cases the models are better off just using better base maps and/or more geometry rather than wasting memory on normal/height maps that aren't going to be noticeable a majority of the time.

Everything you are thinking of has already been considered, and we went with the current method because it simply works the best all around.  So, here is a quick Q&A about this options:

Put the height map data in an extra channel of another map (like glow)
Nothing but the normal map can be modified to contain extra data since all of the other maps are still used by the fixed render pipeline and it has no idea how to properly handle (ie, ignore) the extra data in the maps.

Put the height map data in the alpha channel of the normal map
We need to conserve as much memory as possible, so normal maps need to be compressed.  During testing the compression artifacts were deemed too great in a regular DXT1 or DXT5 format.  Because of that we went with DXT5nm, which uses the green and alpha channels for the normal map, to get the best quality possible.  With the alpha channel in use, and the two remaining channels not having enough precision by themselves for the height map data.

Put the height map data across the red and blue channels in the DXT5nm normal map
Certainly possible from a technical point of view, but is problematic for artists and modders.  No existing tools would be able to work with the files, which means that we would have to create a utility for converting between the formats.  This is problematic on a multitude of levels, basically to the point of not being feasible, even though it is technically possible to do.

Use a extra file for the normal map, but make it 8-bit only
What is the point?  It would actually require more memory than a DXT1c image, and it wouldn't perform as well render speed wise as DXT1c either.  The only thing that you gain is a lossless format, but it isn't all that important in the case of the height map.

Everything needs normal and height maps, so just sacrifice the quality and save the memory
Matter of opinion, and not everyone is going to agree with that.  The shaders are upgradeable by mods though, so they are certainly free to make their content however they choose (like using standard DXT5, with RGB for the normal map and A for the height map) and including modified shader files which work with the content.  But by default, doing this isn't the best option.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: idea for oprimising texture usage
well when i posted it was in the intrest of saving space, i had assumed that sticking it into an alpha channel would save memory when in fact its the same usage. but that assumption was wrong, which i didnt figure out untill after i hit post. that pretty much answers most of my questions.

btw, are there any considerations to take into account for height maps?
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: idea for oprimising texture usage
Just a side note -- do the normal maps only turn on when a ship is within a certain range?  (Sorta like LOD levels)  Or are they always on?

  

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
Re: idea for oprimising texture usage
well when i posted it was in the intrest of saving space, i had assumed that sticking it into an alpha channel would save memory when in fact its the same usage. but that assumption was wrong, which i didnt figure out untill after i hit post. that pretty much answers most of my questions.
It would save save memory to have the height map in the alpha channel, regardless of which image it went in.  But like I said, we can only modify the normal map like that, and it's alpha channel is already in use (by default anyway).

Just a side note -- do the normal maps only turn on when a ship is within a certain range?  (Sorta like LOD levels)
Yes, they are only in use for LOD0 and LOD1, the same as spec maps.