aliens

Author Topic: Globe improvements  (Read 68223 times)

Offline Daiky

  • Battlescape Programmer
  • Administrator
  • Commander
  • *****
  • Posts: 904
    • View Profile
Re: Globe improvements
« Reply #30 on: November 30, 2011, 04:16:19 pm »
you probably have to rewrite the code to get the light shade off a specific lon/lat position.
Getting the shade from the polygon was actually a quick and easy method I used back in those days and is not really the way to do it. It was just waiting to be broken one day.

If I can believe ufopaedia, the original game calculates the local time for the given position, and with a lookup table converts the time of day into the battlescapes' brightness. 6:30-16:30 is full light, 19:00-4:00 is full dark, and something in between for morning and evening hours.
Source: https://www.ufopaedia.org/index.php?title=BGLOB.DAT

I will fix this in the master branch.

Volutar

  • Guest
Re: Globe improvements
« Reply #31 on: November 30, 2011, 08:00:51 pm »
Yankes, that would not be a problem. If you build shade pattern via pixel manipulation, dithering could be easily achieved. Floyd-Steinberg will be fine.

Daiky, yeah, but XCOM used bad shade formula. They haven't payed any attention on the fact, that at the pole point there will always be twilight, because it's always at terminator line. And anyway, it would be real advantage over original, if battlescape shading will be 100% appropriate for shadng observed at globescape.
« Last Edit: November 30, 2011, 08:03:55 pm by Volutar »

Offline Daiky

  • Battlescape Programmer
  • Administrator
  • Commander
  • *****
  • Posts: 904
    • View Profile
Re: Globe improvements
« Reply #32 on: November 30, 2011, 08:14:58 pm »
Well... I agree that the shading on the globe must match the one on the battlescape exactly, I do it often, waiting for site to appear in daylight and then land, it would be frustrating if the two don't match. With the polygon check there is now, it is always 100% correct...
I'll let it be as it is for now, until the globe is not officially changed, the polygon check works. There are more important things, like for example "the medikit" to implement first :)

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Globe improvements
« Reply #33 on: November 30, 2011, 09:25:20 pm »
to get correct shade in battlescape we only need 2 things.
a) normed position of landing site in 3D cords
b) normed vector pointing to sun
now we can easy calculate it by:
Code: [Select]
if(norm(landing_pos - sun_direction)> sqrt(2))
    night();
else
    day();
this is simplest version, more accurate can have more tests.

Yankes, that would not be a problem. If you build shade pattern via pixel manipulation, dithering could be easily achieved. Floyd-Steinberg will be fine.
this will not work, simple because `find_closest_palette_color(oldpixel)` is always equal 0  in my case. I create 32 shades values and I convert them to 32 colors of ocean (in case of lands its 16 colors). Creating more shades is very costly. I could reduce numbers colors of ocean to 16 and then use it but i dont know if effect will be good enough.

I will try hack palette, maybe this at least fix strips on ocean.

Volutar

  • Guest
Re: Globe improvements
« Reply #34 on: December 01, 2011, 03:53:18 am »
Yankes, ocean strips btw dont actually need to be dithered, since there are twice more than land shades.
'is always equal 0  in my case' - mean you've got algorithm wrong. You probably should push what you've made, and we'll see how to make dithering and battlescape light.

Offline Daiky

  • Battlescape Programmer
  • Administrator
  • Commander
  • *****
  • Posts: 904
    • View Profile
Re: Globe improvements
« Reply #35 on: December 01, 2011, 10:33:29 am »
You probably should push what you've made, and we'll see how to make dithering and battlescape light.
Just my 2 cts... maybe a question to SupSuper, but pushing this now means that the interesting stuff that was in the roadmap for beta release 0.4 will be delayed to get this improved globe shade? With interesting stuff I mean the geoscape AI, like the UFO missions :)

Volutar

  • Guest
Re: Globe improvements
« Reply #36 on: December 01, 2011, 12:11:25 pm »
Daiky, how's that? Shading change won't interfere anything except for visual appearence of globe!
BTW, Anotheer question to SupSuper... What about great circle shortest globe trajectories? :)

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Globe improvements
« Reply #37 on: December 01, 2011, 06:43:01 pm »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Globe improvements
« Reply #38 on: December 12, 2011, 07:20:43 pm »
I can say that i finished globe shading. 100% mechanic is done. I used random noise to fuzzy shadow edges.
SupSuper and Daiky, what changes I should do before merging it with rest of code (different than splitting "SurfaceShader.h" into couple of headers, because I will do it anyway)? Is something that you dont like in my code (e.g. naming varabres using 4 different languages :D)?

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Globe improvements
« Reply #39 on: December 14, 2011, 04:30:32 am »
Looks more like you fuzzied everything :P not sure if that effect is good, despite looking nicer, it makes it much harder to tell how dark an area is at a glance, compared to the flat shades.

Edit:
Daiky, how's that? Shading change won't interfere anything except for visual appearence of globe!
BTW, Anotheer question to SupSuper... What about great circle shortest globe trajectories? :)
In my TODO...
« Last Edit: December 14, 2011, 04:32:39 am by SupSuper »

Offline kkmic

  • Commander
  • *****
  • Posts: 582
  • Undefined
    • View Profile
Re: Globe improvements
« Reply #40 on: December 14, 2011, 10:23:05 am »
@SupSuper: +1

Yeah, the effect is kinda dicey... I wouldn't quite go with it for the final version....

Volutar

  • Guest
Re: Globe improvements
« Reply #41 on: December 14, 2011, 11:59:52 am »
SupSuper, kkmic, have you tried this?
I doubt you've made this assumption after trials.:)
I understand you've used to ugly XCOM globe view, and have some misgivings about usability of such smoothness. But, a) terminator line actually is narrower (about 1/66 of circle or 5.5 degrees), comparing to XCOM, so getting into "twilight" zone is not that easy b) Accidental unwanted battle time is happened in original XCOM too, no matter how accurate you're trying to avoid twilight or night.

Yankes, I've noticed, you added noise to all shade areas, to whole night side, which is wrong. Why so? Only terminator line needs to be "smoothed". BTW, width of this line should be tighten and probably corrected. And I noticed, noise doesn't look like being somehow smooth, I can clearly see strip borders. I suggest you to discard idea of "noise-smoothing" and release straight strips. It will be more than enough for the moment :) And after a while probably improve this with noise smoothing.

It's about 5.5 degrees on both sides of night.
Full light is 180 degrees, and night zone is about 169 degrees of globe.

Also...
Can you "smooth" only strips inside of terminator line and with night shade, while keeping "hard" border between terminator line and day light? This would make obvious picture, while it stays smooth and nice.
Pictures are too large, again
« Last Edit: December 14, 2011, 01:19:08 pm by Volutar »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Globe improvements
« Reply #42 on: December 14, 2011, 04:06:27 pm »
Volutar why you dont like my big screnshots? :D its easer to me to work with that resolution, because I can see every pixel without problems.

and about noise on dark side, its side effect of my method. I dont have any good solution for that  (but I have couple bad ones :D ) and for me it didnt look that bad, I simple leaved it without any change. From comets I see that I need find that better solution :)

And thax Volutar for info about shadow position :)

Volutar

  • Guest
Re: Globe improvements
« Reply #43 on: December 15, 2011, 06:35:51 am »
Quote
Volutar why you dont like my big screnshots?
because they dont fit 1280x1024 :P

Quote
and about noise on dark side, its side effect of my method. I dont have any good solution for that  (but I have couple bad ones  ) and for me it didnt look that bad, I simple leaved it without any change. From comets I see that I need find that better solution
Hey, why don't you want to share with what you have? Four eyes see better than two :)
Anyways, I can't give any good suggestions relying only on these shots.

Offline kkmic

  • Commander
  • *****
  • Posts: 582
  • Undefined
    • View Profile
Re: Globe improvements
« Reply #44 on: December 15, 2011, 09:49:41 am »
No, I do not want the stripes back. They are ugly as hell  8)

But if you look at the screenshots, the twilight was done by dithering. Even the night makes use of this system. And to be honest, it does not look nice.

What I would like to see in the final version is a linear "gradient" used for calculation.

Can't you apply an per pixel alpha blending effect depending on it's position in the twilight?