Nothing entered.
[http://sourceforge.net/p/ufoai/patches/506 Item 506] imported from sourceforge.net tracker on 2013-01-28 20:43:43
- Moved gloss and city light maps into the alpha channels of the bump map and the season textures, respectively, and re-wrote the shader rendering code to take advantage of this (fewer images loaded into memory, and fewer texture samplers in the shader).
- The sphere generation code now generates tangents as well as normals for each vertex. The tangents are being used in the geoscape shader code; bump-mapping should look better now.
- Reduced contrast of specularity map, and decreased the specular exponent; water is less shiny.
- Added a glowing border to the nation overlay.
- Changed rendering of the sun to be done as a textured sphere (rather than a billboard) in preparation for adding glow-effect post-processing.
===== Comments Ported from Sourceforge =====
====== arisian (2010-03-27 14:29:29) ======
patch
====== arisian (2010-03-27 14:31:43) ======
Ack, can't attach the textures 'cause they're too big. I'll post them over in the forum I guess...
====== tlh2000 (2010-03-28 08:09:58) ======
applied coding guidelines
====== tlh2000 (2010-03-28 08:14:47) ======
use R_BindArray(GL_TANGENT_ARRAY, GL_FLOAT, sphere->tangents);
====== tlh2000 (2010-03-28 08:18:08) ======
changed R_RotateCelestialBody a little bit - vec4_t is already a pointer
====== tlh2000 (2010-03-28 08:20:02) ======
R_LoadShader: geoscape_vs.glsl: 0(45) : error C1115: unable to find compatible overloaded function "cross(vec3, error)"
0(45) : error C1115: unable to find compatible overloaded function "normalize(error)"
R_LoadShader: geoscape_fs.glsl: 0(50) : error C1115: unable to find compatible overloaded function "normalize(error)"
0(51) : warning C7011: implicit cast from "vec4" to "vec3"
0(64) : warning C7011: implicit cast from "vec4" to "vec3"
0(64) : error C1115: unable to find compatible overloaded function "clamp(float)"
0(64) : error C0000: syntax error, unexpected floating point constant at token "<undefined>"
0(64) : error C0501: type name expected at token "<undefined>"
line numbers are +9
====== tlh2000 (2010-03-28 08:23:37) ======
sorry - had a typo in my shaders - forget the last comment
====== tlh2000 (2010-03-28 08:24:13) ======
fixed TANGENT variable name
====== arisian (2010-03-28 23:51:13) ======
I did some more work on the shaders, particularly getting the specular stuff to be both efficient and correct (at least, I think it's as correct as it's able to be given that we're using an orthographic view). I've attached a new patch (against current svn trunk); this patch should replace the previous one. The same textures should work, though. I've got some slightly improved versions of a couple of the textures here, but the code should work with the ones I posted yesterday.
====== arisian (2010-03-28 23:51:49) ======
updated patch; use this version rather than the previous one
====== tlh2000 (2010-03-29 05:38:53) ======
for the records - the textures are here: http://cs.jhu.edu/~ben/graphics/ufoai/
====== tlh2000 (2010-03-29 05:42:04) ======
screenshot of the patch - used lowres_textures.zip
====== tlh2000 (2010-03-29 05:42:18) ======
attached is a screenshot of how it looks for me
====== arisian (2010-03-29 12:54:19) ======
Hmm, that's odd; I've just attached a screenshot of how it looks for me. I still think it's most likely to be an issue with the textures rather than the shaders, but I suppose there's no way of knowing. Go over to the website and grab new copies of the following files (the last three links on the page):
map_earth_bump.png
map_earth_season_00.png
map_earth_nations_overlay_glow.png
Then be sure you're using season00 for *all* the seasons (on linux, do "for i in `seq -w 1 11`; do ln -s map_earth_season_00.png map_earth_season_$i.png; done"). Or I guess you could edit r_draw.c to be sure that only season_00 was getting loaded.
Let me know if that fixes the "white" problem or not.
====== tlh2000 (2010-03-29 16:10:28) ======
it works with the high res textures
====== arisian (2010-03-30 02:36:11) ======
It looks like the issue is the JPEG format; it doesn't support "transparency," which translates to meaning you can only store 3 channels. The new-and-improved version saves space (on disk and in memory) by using the 4th channel (the "alpha" channel) to store the night-time and gloss maps, since they're grayscale anyway, and therefore only need one channel. OpenGL stores everything as RGBA as far as I can tell anyway, so it's really a lot more efficient at runtime to use that extra channel for something rather than load an entire other texture. But it doesn't look like the JPEG format is compatible with this scheme; we'll either need to go back to having several extra (large) textures in memory, or use a different image format. My preference would be for the latter. I'm a big fan of .PNG as a format because it's lossless, but that same fact means it won't compress as far. I'm not sure how small we need the images, though; at 4096x2048, the map_earth_season_XX.png files are about 6Mb each; check out the "medium" resolution texture zipfile on the website, which contains all the season images at 4096x2048 as .pngs.
====== tlh2000 (2010-03-30 05:49:16) ======
using png with compression for the standard files that we will add to the svn is fine, too
====== arisian (2010-03-30 15:14:02) ======
I can make versions of the files matching pretty much whatever specs you give me; what kind of resolution are we looking for, and what file size? The actual file size is mostly important for the purposes of downloading UFOAI; the resolution is really all that's important in terms of runtime resource requirements, since everything gets loaded into memory as opengl texture images regardless of what the file format or compression level is.
For my personal use, I really think that the 8192x4096 images make a big difference when you zoom all the way in; they're still crisp, and don't look blurry at max-zoom the way the lower resolutions do. However, they take a lot of memory to store; I suspect that you'll need 2Gb of RAM to be able to actually use them. The old geoscape image, map_earth_day.jpg is a 4096x2084 image, which works fine, but given that we're now loading several extra textures (two "season" textures and one "bump" texture, as opposed to the old version which only had map_earth_day), I don't know if that's going to be too high a resolution or not. We can go lower, but visual quality will suffer.
After we've picked a resolution, I can play with different compression settings to trade off quality against file size, but I'm unsure what sort of file size I should be trying to achieve.
====== tlh2000 (2010-03-30 15:34:02) ======
Width: 4096 pixels
Height: 2048 pixels
for the standard resolution - but we still can offer a different pk3 with higher resolution geoscape textures - the problem is that the load times are much higher if we use 8192x4096 for each texture.
====== tlh2000 (2010-03-30 15:35:09) ======
as of the file size - 3-4 mb would be really cool (if that's doable with png)
====== arisian (2010-03-30 16:02:39) ======
Okay, I'll see what I can do. I can get them down to ~6.4Mb losslessly, but I should be able to reduce the quality a bit and get them down to 3-4Mb.
====== tlh2000 (2010-03-30 19:02:43) ======
/offtopic on
#!/bin/bash
SUM=0; for i in $(find . -name "*.tga" -print); do FS=$(ls -l $i | tr -s " " | cut -d " " -f 5); SUM=$(($SUM + $FS)); done; echo "Total size of TGA: $SUM"
SUM=0; for i in $(find . -name "*.png" -print); do FS=$(ls -l $i | tr -s " " | cut -d " " -f 5); SUM=$(($SUM + $FS)); done; echo "Total size of already existing PNGs: $SUM"
for i in $(find . -name "*.tga" -print); do j=${i%.tga}.png; svn move $i $j; cp $j $i; convert $i $j; rm $i; done
SUM=0; for i in $(find . -name "*.png" -print); do FS=$(ls -l $i | tr -s " " | cut -d " " -f 5); SUM=$(($SUM + $FS)); done; echo "Total size of PNGs: $SUM"
i've played around with converting all TGAs to PNGs to reduce the size of the svn and the installer - we can reduce the size by more than 100MB if we convert to PNG, but i'm not sure whether the imagemagick call will do that in the best quality or if some gimp batch script should do the job.
/offtopic off
====== nobody (2010-03-30 19:17:48) ======
/offtopic on
imagemagick 'convert' actually seems to do a pretty good job of optimizing PNGs without any special options. If you really want to squeeze them as small as possible, you can use programs like 'optipng' and 'advpng', eg:
#!/bin/bash
# create backup copy
cp $1 $1.orig
# shrink the PNG using three tools:
#convert to colormap based-image if there are few enough colors
pngrewrite $1 $1
#find optimal set of filters to use
#do maximal search for best results possible (takes a long time):
#optipng -zc1-9 -zm1-9 -zs0-2 -f0-5 $1
#do slightly less exhaustive search, usually does just as well:
optipng -o7 $1
#find optimal compression
advpng -z4 $1
# display file sizes of the original and compressed image
ls -sla $1*
Using this technique on the 4096x2048 images only reduced their size from the 6.3Mb that 'convert' produced to 6.2Mb, but for other types of images it may do better. In terms of "quality" you really don't need to worry; PNGs are a lossless format by design. I have yet to find any tool that will reduce their quality in an automated way. TGAs are also lossless, I believe, but have a much less flexible compression scheme than PNGs.
/offtopic off
====== nobody (2010-03-30 19:48:52) ======
Another format option is TIFF; that format allows lossy compression but can handle transparency. Converting from PNG to TIFF reduces one of the season images from 6.2Mb to 3.6Mb.
At the moment, however, the UFOAI codebased doesn't seem to have support for TIFF files. If you wanted to include it, the libTIFF library (http://www.remotesensing.org/libtiff/) should work. It's not GPL, but it is free (as in both speech and beer); you can use, distribute, modify, whatever as long as you include the original copyright (http://www.remotesensing.org/libtiff/misc.html).
====== arisian (2010-04-08 21:43:21) ======
latest version of the geoscape; much improved
====== arisian (2010-04-08 21:43:22) ======
Added a new patch; this version is both more feature rich and should be more flexible with respect to different system configurations. In addition to the patch, a number of other files are required; they can be obtained from:
http://cs.jhu.edu/~ben/graphics/ufoai/
====== arisian (2010-04-10 00:36:11) ======
New patch; this version now handles different resolutions properly, including changing resolutions on-the-fly. Specularity has also been temporarily disabled in geoscape_fs.glsl until I fix it properly (I'm hoping Fresnel's equations might help, but that's a separate project).
Be sure to re-download the "common.tar.bz2" file, as one of the textures has changed (don't worry, it's small).
====== arisian (2010-04-10 00:36:51) ======
even newer version; minor fixes and improvements
====== tlh2000 (2010-04-10 06:54:28) ======
applied to trunk now - thanks a lot for the work
i've performed minor modifications to the patch posted here.
====== tlh2000 (2010-04-10 06:54:40) ======
oh - it was commited in r29282