Great Progress: Hires bumping with DDS (8:1) NORMAL maps
Posted: 13.01.2003, 01:03
At last, I got it right;-).
Since quite some time, I have tried to associate
the hires bump files with highly compressed DXT format, too. The
essential /slowing-down/ of the fps rate in the display of hires bumped
textures came from the fact that up-to-now one had to use *.png or
*.jpg bump files in Celestia 1.2.5.
Here is how the solution works:
In the Celestia code (texmanager.cpp, texture.cpp), the bumpmap files
are converted into so-called /normal maps/ and stored as
such internally, provided a non-vanishing BumpHeight is entered in
solarsys.ssc; i.e. from adjacent pixels, in each point, the normal is
computed that characterizes the bumpyness of the texture. The trick is
now to use NVIDIA's Windows command-line utility, 'NormalMapGen', for
converting /externally/ a hires bump.tga file first into the corresponding
NormalMap.tga file. The latter is a standard 24bit rgb file and in a
second step, is then converted into DXT1c (8:1) format. All one has to
do in solarsys.ssc is to put for Earth
BumpHeight 0.0
BumpTexture "earth-normal.dds"
and analogously for Mars
BumpHeight 0.0
BumpTexture "mars-normal.dds"
whence internally the conversion step to a normalMap is /skipped/ and
earth|mars-normal.dds is correctly interpreted as a normal map;-). Besides
the amazing 8:1 compression, also the lacking conversion from bump
to normal map saves a lot of storage and time, respectively.
The art is now to generate the cleanest and smoothest possible normal
map. For Earth, for example, I start from the original 24bit grayscale
10k SpaceGraphics earth-bump.jpg's and reduce them (cubically) to
8k,4k,2k with GIMP. Without saving the JPG file, I create a new
8k,4k,2k transparent grayscale file and compose a RGBA
earth-bump.tga file with the earth-bump.jpg as alpha channel for each
resolution. Then the crucial command is
NormalMapGen earth-bump.tga earth-normal.tga <scale> -w 5x5
which generates the output earth-normal.tga NormalMap file from the
height info in the alpha channel using 5x5 sampling. The 24bit DDS
conversion call subsequently reads
nvdxt -file earth-normal.tga -24 dxt1c
As result, earth-normal.dds is written. With the scale factor <scale>
one has to play a little. I found <scale> = 7.5, 4.5 satisfactory for 8k, 4k
normal maps of Earth, for example.
That's it! As an illustration, I display below 2 hires Earth shots and one
from Mars. The 1st earth shot has a /16k earth.dds/ texture and a /8k
earth-normal.dds/ texture, the second earth shot has a /8k earth.dds/
texture and the same /8k earth-normal.dds/. The Mars shot was a 8k
mars.dds texture with a 8k mars-normal.dds texture.
Most importantly, watch the /fps-rates/ in the lower left of the
shots!!! This is just amazing, given my old 32MB GF2 card...Moreover,
as you may e.g. judge from the second earth image, the display of the
elliptical plane ground is completely free of pixel trash that is so
often visible there upon normal bumpmapping!
As soon as I find time, I shall deposit the new normal maps on my
TextureFoundry site for download. Of course, Grant's corrections are
incorporated for Mars.
Bye Fridger
Since quite some time, I have tried to associate
the hires bump files with highly compressed DXT format, too. The
essential /slowing-down/ of the fps rate in the display of hires bumped
textures came from the fact that up-to-now one had to use *.png or
*.jpg bump files in Celestia 1.2.5.
Here is how the solution works:
In the Celestia code (texmanager.cpp, texture.cpp), the bumpmap files
are converted into so-called /normal maps/ and stored as
such internally, provided a non-vanishing BumpHeight is entered in
solarsys.ssc; i.e. from adjacent pixels, in each point, the normal is
computed that characterizes the bumpyness of the texture. The trick is
now to use NVIDIA's Windows command-line utility, 'NormalMapGen', for
converting /externally/ a hires bump.tga file first into the corresponding
NormalMap.tga file. The latter is a standard 24bit rgb file and in a
second step, is then converted into DXT1c (8:1) format. All one has to
do in solarsys.ssc is to put for Earth
BumpHeight 0.0
BumpTexture "earth-normal.dds"
and analogously for Mars
BumpHeight 0.0
BumpTexture "mars-normal.dds"
whence internally the conversion step to a normalMap is /skipped/ and
earth|mars-normal.dds is correctly interpreted as a normal map;-). Besides
the amazing 8:1 compression, also the lacking conversion from bump
to normal map saves a lot of storage and time, respectively.
The art is now to generate the cleanest and smoothest possible normal
map. For Earth, for example, I start from the original 24bit grayscale
10k SpaceGraphics earth-bump.jpg's and reduce them (cubically) to
8k,4k,2k with GIMP. Without saving the JPG file, I create a new
8k,4k,2k transparent grayscale file and compose a RGBA
earth-bump.tga file with the earth-bump.jpg as alpha channel for each
resolution. Then the crucial command is
NormalMapGen earth-bump.tga earth-normal.tga <scale> -w 5x5
which generates the output earth-normal.tga NormalMap file from the
height info in the alpha channel using 5x5 sampling. The 24bit DDS
conversion call subsequently reads
nvdxt -file earth-normal.tga -24 dxt1c
As result, earth-normal.dds is written. With the scale factor <scale>
one has to play a little. I found <scale> = 7.5, 4.5 satisfactory for 8k, 4k
normal maps of Earth, for example.
That's it! As an illustration, I display below 2 hires Earth shots and one
from Mars. The 1st earth shot has a /16k earth.dds/ texture and a /8k
earth-normal.dds/ texture, the second earth shot has a /8k earth.dds/
texture and the same /8k earth-normal.dds/. The Mars shot was a 8k
mars.dds texture with a 8k mars-normal.dds texture.
Most importantly, watch the /fps-rates/ in the lower left of the
shots!!! This is just amazing, given my old 32MB GF2 card...Moreover,
as you may e.g. judge from the second earth image, the display of the
elliptical plane ground is completely free of pixel trash that is so
often visible there upon normal bumpmapping!
As soon as I find time, I shall deposit the new normal maps on my
TextureFoundry site for download. Of course, Grant's corrections are
incorporated for Mars.
Bye Fridger