kirides / GD3D11

D3D11-Renderer for Gothic and Gothic 2
GNU General Public License v3.0
200 stars 18 forks source link

Sun does not move when AtmosphericScattering is disabled #122

Open SaulMyers opened 1 year ago

SaulMyers commented 1 year ago

I've noticed that with AtmosphericScattering disabled, the sun just sits in the default position and doesn't move with the time of day. I suspect this code here is the problem but I don't know why - the 'sky->RenderSky();' call is made and this calculates the angle of the sun.

Tested in G1 and G2.

image

lucifer602288 commented 1 year ago

I confirm this behaviour with AtmosphericScattering disabled. And then at 12 o`clock with the most recent sun time code the sun jumps. The sun jumps only with AtmosphericScattering disabled.

SaulMyers commented 1 year ago

I quite like the look of the sky with atmospheric scattering turned off so I'd like to fix it, but no luck so far.

RE the sun still jumping at 12PM, I hadn't noticed that but that's also something I'd like to solve. I had some code that worked but junked it when the latest merge introduced new logic. I'll have another look at that too when I get time.

SaulMyers commented 1 year ago

Correction, the sun does move with atmospheric scattering turned off, it's just not in sync with the light direction and is not altered by the timescale. You can see the godrays move around the sky when you turn the time scale up, but not the sun.

So it seems that I need to work out how to alter the position of the 'original' sun, as opposed to atmospheric scattering's version of the sun, which is displayed via a shader. Turning AS off seems to display the old engine's sky.

The 'old' sky includes the moon at night too, so it would be good to get this working.

@kirides if you have any input on this then please chime in. I had a look at older versions of the renderer (like X11 old) and it didn't include the option to turn AS off at all.

Changing the position of the 'original' sun might require a hook back into the old engine...?

lucifer602288 commented 1 year ago

Fixed by SaiyansKing: https://github.com/SaiyansKing/GD3D11/commit/a91e463fdb4963920fe7272a6caedd844c1c491c

SaulMyers commented 1 year ago

Thanks for this SaiyansKing! I wish the devs I work with were this responsive 😁

Looks good so far - sun position looks right and moon appears at night which is great. But I'll continue testing and report back if I see any issues.

In the mean time I'll close this issue.

SaulMyers commented 1 year ago

No issues with this in the base game but the sun doesn't move correctly in the add-on world with atmospheric scattering disabled I'm afraid:

image