Try Y-shearing for fake sky?

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
afritz1
Posts: 43
Joined: Thu Nov 24, 2016 1:19 am
Contact:

Try Y-shearing for fake sky?

Post by afritz1 »

I think we can agree that the fake sky in Daggerfall doesn't look or feel all that nice. I just compared the behavior between the original game and Daggerfall Unity, and they appear to be roughly the same (i.e., same function, slightly different magnitudes), but maybe we can do better (and yes, I'm aware of the modern sky mod).

Perhaps we could deviate from the original behavior by seeing if Y-shearing would be a better solution to the problem. Basically, Y-shearing uses the tangent of the player's angle relative to the horizon instead of some linear function, and in theory it should provide a better approximation for where the horizon is on-screen (although I'm not sure; it could look completely wrong).

If you show me where the fake sky position is calculated, I could try experimenting with it some. I just need to be able to get the field of view and the angle of the camera relative to the horizon. I don't know if it'll look any good, but I guess we'll find out!

User avatar
King of Worms
Posts: 4751
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Try Y-shearing for fake sky?

Post by King of Worms »

I was told nothing can be done about it, but I refuse to believe that we cant align a background to the foreground in 2018. Im glad you opened this, lets see where it will lead :)

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Try Y-shearing for fake sky?

Post by Interkarma »

Even small improvements would be most welcome. :) If you'd like to trial some ideas, everything is calculated in DaggerfallSky class.

Sky offset is calculated in UpdateSkyRects() which ultimately sets the eastRect and westRect fields used by DrawSky(). The sky is just a 2D backdrop behind the 3D scene like classic.

Just let me know if any more information is needed. Good luck, let me know how you go!

User avatar
afritz1
Posts: 43
Joined: Thu Nov 24, 2016 1:19 am
Contact:

Re: Try Y-shearing for fake sky?

Post by afritz1 »

Okay, I was able to get it working. See this pull request:
https://github.com/Interkarma/daggerfall-unity/pull/578

It's kind of a subtle change, but I think it helps make the fake sky look a little nicer, and feel a little bit less nauseating. On another note, this was the first time I pulled down Daggerfall Unity and got it running! Maybe I could find some other things to help with in the future.

User avatar
King of Worms
Posts: 4751
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Try Y-shearing for fake sky?

Post by King of Worms »

Great cant wait to see it ingame!!

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Try Y-shearing for fake sky?

Post by Interkarma »

That was fast! :)

I'll get this merged soon, looking forward to trying it out.

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Try Y-shearing for fake sky?

Post by Hazelnut »

Wow, that's so much better! Nice work. :)
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
afritz1
Posts: 43
Joined: Thu Nov 24, 2016 1:19 am
Contact:

Re: Try Y-shearing for fake sky?

Post by afritz1 »

I'm glad it worked! I guess my hunch paid off. The Y-shearing algorithm is already being used by my own software renderer, so it was only a matter of tweaking it some to work with Daggerfall Unity's graphics. I think more people will be okay playing with the old sky now instead of depending on the modern sky mod.

Post Reply