aliens

Author Topic: Globe improvements  (Read 57672 times)

Volutar

  • Guest
Globe improvements
« on: January 26, 2011, 04:34:09 pm »
It's a first patch from me.
Conjuction point of poles have had some issues with shading because of all vertexts used for shade estimation.
This patch make shading function skip pole vertexes since they dont have actual longitude.

Also I'm aiming to make world.map patch for more detailed poles and other rough terrain locations, for better lighting.
Method - make world.dat->world.obj exporter and world.obj->world.dat importer. And use any obj editor to fix some details.

Volutar

  • Guest
Re: Globe improvements
« Reply #1 on: January 27, 2011, 10:21:26 am »
North pole vertex shared only by 3 polygons, so it's not strange it looks ugly.

As I see for the moment lighting calculated for bounding squares for each polygon.
I don't think it's good approach, since bounding squares could be heavily overlapped and lighting could look ugly. I'll try to use polygon middlepoint and will see how it come.
« Last Edit: January 27, 2011, 10:24:32 am by Volutar »

Offline AlienRape

  • Sergeant
  • **
  • Posts: 28
    • View Profile
Re: Globe improvements
« Reply #2 on: July 07, 2011, 11:18:01 am »
Is that world viewer application (shown above) available for download (and play with?)

Volutar

  • Guest
Re: Globe improvements
« Reply #3 on: July 07, 2011, 11:21:16 pm »
Sure, but it's just a viewer. It doesn't allow to change anything...
Here

Offline AlienRape

  • Sergeant
  • **
  • Posts: 28
    • View Profile
Re: Globe improvements
« Reply #4 on: July 08, 2011, 08:18:22 am »
Nice.
Did you write that? If you don't mind me asking...what was it written in?
Do the coloured terrain polygons simply map (spatially) over a blue globe?

Volutar

  • Guest
Re: Globe improvements
« Reply #5 on: July 09, 2011, 10:58:32 am »
In Delphi7.
Yep. Blue circle/rectangle (depending on mode) + colored polygons.

Volutar

  • Guest
Re: Globe improvements
« Reply #6 on: September 23, 2011, 05:17:44 am »
I've slightly updated my viewer by adding "site" display functionality (you can select particular area in the second list at right side, current area marked as red, whole site as pink; displayed as X.Y.Z where X is zone, Y is stage and Z is location).

In short: xcom uses list of "random" areas (720 entries, file randomsites.dat: {shortint x,y,width,height}).
Alien activity divided upto 12 earth zones (described in ufopaedia).
These 60 areas divided to 6 "stages" so every stage have only up to 10 locations. These stages used for UFO trajectory calculation.

For example, research mission. They've scripted 3 levels of progression.
<ct_SmallScout, 1, 0, 300>
<ct_MediumScout, 1, 2, 260>
<ct_LargeScout, 2, 4, 300>
Values are: CraftType, NumberOfUFOs, Trajectory_Type, Timeout.
So they're using trajectory_types 0,2 and 4.

0:
dw 5                      ; UFO_Waypoint_count
dw   5,  0,  0,  1,  5, -1, -1, -1; UFO_Waypoint_Site
dw   4,  3,  1,  1,  2,  0,  0,  0; UFO_Waypoint_Altitude
dw 100, 74, 28, 47,100,  0,  0,  0; UFO_Waypoint_Speed
dw 3000                   ; Ground_Timer
2:
dw 5                      ; UFO_Waypoint_count
dw   5,  0,  0,  1,  5, -1, -1, -1; UFO_Waypoint_Site
dw   4,  3,  2,  1,  0,  0,  0,  0; UFO_Waypoint_Altitude
dw 100, 57, 26, 50,100,  0,  0,  0; UFO_Waypoint_Speed
dw 5000                   ; Ground_Timer
4:
dw 8                      ; UFO_Waypoint_count
dw   5,  0,  0,  2,  0,  0,  2,  5; UFO_Waypoint_Site
dw   4,  2,  2,  1,  0,  2,  1,  0; UFO_Waypoint_Altitude
dw 100, 67, 52, 40, 30, 20, 30,100; UFO_Waypoint_Speed
dw 7000                   ; Ground_Timer

So obviously UFOs starting at site5 and "lost track" through site5.
site0 often covers whole land area, while site2 is located at number of really narrow areas over land, and site1 is something between site0 and site1 (you can watch them through selecting area in viewer).
When UFO is moving towards next waypoint, it has fixed altitude and speed. When it reaches next waypoint, it "calculates" where's it want to fly next (it peeks random location from next Zone->Stage area set). Altitude==0 means ground level, when it reaches this point, it landed, and turned into green cross, which will stay there for around Ground_Timer*5secs.

P.S.: Site3 is often a CITY layer, with area width==0 and height==0, and this location chunks used when starting terror missions.
« Last Edit: September 23, 2011, 06:04:18 am by Volutar »

Offline bramcor

  • Captain
  • ***
  • Posts: 76
    • View Profile
Re: Globe improvements
« Reply #7 on: September 27, 2011, 07:30:36 pm »
For example, research mission. They've scripted 3 levels of progression.

Code: [Select]
<ct_SmallScout,  1, 0, 300>
<ct_MediumScout, 1, 2, 260>
<ct_LargeScout,  2, 4, 300>

Values are: CraftType, NumberOfUFOs, Trajectory_Type, Timeout.
So they're using trajectory_types 0,2 and 4.

Code: [Select]
0:
dw    5                             ; UFO_Waypoint_count
dw    5,  0,  0,  1,   5, -1, -1, -1; UFO_Waypoint_Site
dw    4,  3,  1,  1,   2,  0,  0,  0; UFO_Waypoint_Altitude
dw  100, 74, 28, 47, 100,  0,  0,  0; UFO_Waypoint_Speed
dw 3000                             ; Ground_Timer

2:
dw    5                             ; UFO_Waypoint_count
dw    5,  0,  0,  1,   5, -1, -1, -1; UFO_Waypoint_Site
dw    4,  3,  2,  1,   0,  0,  0,  0; UFO_Waypoint_Altitude
dw  100, 57, 26, 50, 100,  0,  0,  0; UFO_Waypoint_Speed
dw 5000                             ; Ground_Timer

4:
dw    8                             ; UFO_Waypoint_count
dw    5,  0,  0,  2,  0,  0,  2,   5; UFO_Waypoint_Site
dw    4,  2,  2,  1,  0,  2,  1,   0; UFO_Waypoint_Altitude
dw  100, 67, 52, 40, 30, 20, 30, 100; UFO_Waypoint_Speed
dw 7000                             ; Ground_Timer

Found the numbers interesting, so I thought I'd help make them a tiny bit more reable :)

Keep up the good work!

Volutar

  • Guest
Re: Globe improvements
« Reply #8 on: October 06, 2011, 01:54:51 pm »
I've found formulas of direction vector toward particular alt/long globe location. So folowing this direction each "tick" you will get to destination point by shortest distance (along great cirle).
It is also possible to use it for drawing globe route to destination point.

x:=sin(long2-long1)*cos(lat2);
y:=cos(lat1)*sin(lat2)-sin(lat1)*cos(lat2)*cos(long2-long1);

1 is source coordinate, and 2 is destination
latitude is 0 at equator, -pi at north pole and +pi at south pole

This vector (x,y) is not normalized, so it become almost 0 near target location and on the other side of globe (thus it should be normalized).

I think there might be some problems when passing pole (latitude near +-180 degrees), it requires some tests
« Last Edit: October 06, 2011, 02:24:45 pm by Volutar »

Volutar

  • Guest
Re: Globe improvements
« Reply #9 on: October 06, 2011, 04:56:32 pm »
Formula above works well.
Another thing needed for proper globe path tracing is longitude scaling (according latitude) of vector:
new_long_offset/=cos(new_lat);

Volutar

  • Guest
Re: Globe improvements
« Reply #10 on: October 06, 2011, 09:32:14 pm »
Viewer application updated and uploaded.
Now it draws "shortest path" in 2D and 3D and can reassign destination location by left mouse click. Trajectory start location is in Siberia Middle click will set source location. You can see how strange "shortest path" may look in 2D.
« Last Edit: October 07, 2011, 10:03:51 am by Volutar »

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
Re: Globe improvements
« Reply #11 on: October 08, 2011, 04:48:35 pm »
is possible to use different cord for poles?
if points on patch are too close pole, you change your cord to {x,y,z} and you simple create line from one point to another. after that you can go back to 2d cords or to alt/long.

Volutar

  • Guest
Re: Globe improvements
« Reply #12 on: October 08, 2011, 08:52:39 pm »
Why should we use different coord for poles?

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
Re: Globe improvements
« Reply #13 on: October 08, 2011, 11:30:18 pm »
because your patch get crazy when you set it though poles. if we would  use different cords we could have straight patch there.

Volutar

  • Guest
Re: Globe improvements
« Reply #14 on: October 09, 2011, 12:10:50 am »
My patch? do you mean this patch of near-pole lighting correction or what?

Jumping of trajectory near pole is a side-effect of having trajectory granularity of 111km "jumps".