colobot / colobot

Source code of open-source Colobot: Gold Edition project developed by Epsitec and TerranovaTeam
http://colobot.info/
GNU General Public License v3.0
1.11k stars 189 forks source link

Sky background is stretched and rotated incorrectly #1584

Open sparr opened 1 year ago

sparr commented 1 year ago

When watching the cut scene before the first moon mission, or when looking up from the moon, the earth and moon appear as ellipses. I suspect this is related to my screen resolution. The background should be cropped or letterboxed, not stretched.

Also, when rotating my viewpoint, the sky background rotates in a weird way that doesn't match up. This is disconcerting and nauseating.

immibis commented 1 year ago

I worked on the sky rendering several years ago (#1021) as I noticed some egregious problems. The sky is rendered using 2D techniques only, which probably made sense in 2001, but it easily leads to inconsistencies like this. I wouldn't be at all surprised to learn there are still more inconsistencies with it.

IMO the proper fix will be to render the sky using 3D techniques - turn the background into a skybox, and calculate 3D positions for all the planets and render them as billboards.

immibis commented 1 year ago

I confirm the bug with the planets in the current dev commit (9417b916da9bbdb866d393feb82161679b613ff5). They stretch themselves to match the aspect ratio of the window.

The background stretches vertically to match your window height, but not horizontally, but it's not a huge problem as long as the background only contains some random stars.

sparr commented 1 year ago

@immibis do you also see the sky rotation not behaving properly when you turn your view in game?

immibis commented 1 year ago

@sparr Yes. That is another thing that might require a full 3D sky to fix. I submitted a PR to fix the squashed planets because at least that part is easy.

immibis commented 1 year ago

I had a go at 3D planet rendering but I don't like the way it looks, especially because planets go higher up on the screen as they go closer to the edge of your screen (this is mathematically expected if you think about a circle rotating over your head, but it looks weird) and because the size of the planets changes with your FOV in first-person camera mode (this one might be a bug on my part).

Maybe instead we just keep the 2D picture but rotate it if the camera is rolled