project-navigation
Personal tools

Author Topic: Improved 3D Geoscape Rendering [was: Nightime city lights in 3D geoscape]  (Read 84007 times)

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
btw. the biggest problem i see with this is that most people out there won't have more than 4 texunits

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
btw. the biggest problem i see with this is that most people out there won't have more than 4 texunits

And if it hangs for 3 secs on a gf 9800gt it will be unusable for quite some players (and devs). 25Mb images are huge IMHO. The current memory usage of UFO:AI is already too high.

-geever

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
that's why he's using lower res textures - the high res textures won't be included but will be offered as a separate pk3 that can be downloaded. also this feature isn't activated for none-glsl cards anyway.

Offline Yatta

  • Rookie
  • ***
  • Posts: 57
    • View Profile
I really dont know much about graphical optimisation, but cant the lights picture be divided in sub parts for continents (also you dont need light texture for the oceans) ? It would allow higher res - which is quite needed to keep the 'crisp' feeling of light souces (the blur does not really fit).

Also, since its just white light, maybe there some way somewhere to optimise the file/process by reducing the palette ? Once again I dont know much in that domain.

Offline arisian

  • Rookie
  • ***
  • Posts: 91
    • View Profile
Okay, here's another new-and-improved version; it integrates better with the existing systems.  Also, for the record, you don't actually need more than 4 texture *units*, you just need more than 4 texture addressable *coordinates.*  The major problem I was running into earlier, as it turned out, was that the code in r_program.c was refusing to give me the texture references I was asking for because it was capping them at the 4 units that my card has.  The code now checks both GL_MAX_TEXTURE_UNITS and GL_MAX_TEXTURE_COORDS, and uses the latter when deciding whether functions like R_SelectTexture succeed or not.

It would also be easy to get rid of the changing seasons, which would require fewer texture units, less memory, and so forth.  It seemed like a nifty feature, but it may not be worth the resources required.  It would also be fairly easy to do the rendering of the city lights as a separate pass, which would mean another texture address that wouldn't be required, but it seemed better to do it all in one pass.  Besides, I had just learned GLSL, so I wanted to flex its muscles a little :)

In terms of the light textures, the light is actually off-white at the moment (slightly yellow looks more correct).  It would be easy enough to simply use a grayscale image, which would certainly mean a smaller file on disk, but I don't think it would help much in terms of graphics card memory (someone correct me if I'm wrong).

Offline arisian

  • Rookie
  • ***
  • Posts: 91
    • View Profile
The high-res textures are now available at:

http://cs.jhu.edu/~ben/graphics/ufoai/

Offline Kildor

  • Project Artist
  • Captain
  • ***
  • Posts: 757
  • Project mapper and some other stuff`er
    • View Profile
    • http://ufoai.nx0.ru
arisian, with last version of your patch I get the same problems with compiling:
Code: [Select]
||=== ufo, windows_debug ===|
ufoai\src\client\renderer\r_program.c||In function 'R_LoadShader':|
ufoai\src\client\renderer\r_program.c|360|warning: passing argument 3 of 'qglShaderSource' from incompatible pointer type|
ufoai\src\client\renderer\r_program.c|360|note: expected 'const GLchar **' but argument is of type 'char **'|
ufoai\src\client\renderer\r_sphere.c||In function 'R_SphereRender':|
ufoai\src\client\renderer\r_sphere.c|228|warning: implicit declaration of function 'glClientActiveTexture'|
.objs\client\src\client\renderer\r_sphere.o||In function `R_SphereRender':|
ufoai\src\client\renderer\r_sphere.c|228|undefined reference to `glClientActiveTexture'|
||=== Build finished: 1 errors, 2 warnings ===|

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
applied to trunk now - some todo comments are left and some cleanup should still be made though.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
the specular lighting needs some work imo. it's not realistic to have a bright light spot on one particular part of the globe

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Okay, I've tried what was committed in trunk up until r29121, and I must say it looks absolutely appalling. The textures have huge jpg compression artifacts. Since the memory usage for the texture is going to be the same in any case, I must insist on better quality textures (at that resolution). I will see what I can do about this.

How did you make the lights texture? Simple level adjustments over the original night texture?

Offline MCR

  • PHALANX veteran
  • ******
  • Posts: 1244
    • View Profile
Wow !
This screenshots looks great !
Even better than I imagined it to be  ;)
Immediately have to test this...  ;D

Offline MCR

  • PHALANX veteran
  • ******
  • Posts: 1244
    • View Profile
BTW, IMHO we should include the highest quality textures also, we can always implement a downgrade option in the graphic-options for those who do not have fast gfx-cards, but this will be a top feature for people with modern middle to high-end cards  ;)

I can't wait to test this  ;D

Offline MCR

  • PHALANX veteran
  • ******
  • Posts: 1244
    • View Profile
Okay, I've tried what was committed in trunk up until r29121, and I must say it looks absolutely appalling. The textures have huge jpg compression artifacts. Since the memory usage for the texture is going to be the same in any case, I must insist on better quality textures (at that resolution). I will see what I can do about this.


jpg is really often bad in terms of artifacts, maybe you could try maximally compressed pngs ?

Offline MCR

  • PHALANX veteran
  • ******
  • Posts: 1244
    • View Profile
I have made some experiments with a very detailed normalmap of map_earth_day @ a resolution of 4096x2048:

1. jpg Full Compression: ugly, many artifacts, 1.18 MB
2. jpg HQ: still ugly, but much better now, 8.31 MB
3. png Full Compression: almost no artifacts, but 14.3 MB

Hope that helps in the decision finding process  ;)