Implement interpolated skybox stars#871
Merged
louist103 merged 2 commits intoHarbourMasters:develop-satokofrom Nov 25, 2024
Merged
Implement interpolated skybox stars#871louist103 merged 2 commits intoHarbourMasters:develop-satokofrom
louist103 merged 2 commits intoHarbourMasters:develop-satokofrom
Conversation
10b5131 to
15d2046
Compare
Contributor
Author
|
I could also see this worth being pointed to Satoko instead so that it gets release sooner. Edit: On second thought, I think this should go into Satoko, as I plan to make a couple other quick fixes. |
15d2046 to
07e7b71
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds an implementation to interpolate the skybox stars. The stars are originally drawn using texture rectangles, which are not possible to interpolate. Instead we have to draw the stars as quads against the projection matrix to take advantage of the matrix interpolation system.
The stars have "real" world positions which we can use to position a matrix, and then scale to match the shape of each star, then we apply the billboard matrix rotation so that they always face the camera. We have to perform additional math on the star positions to bring the stars "closer" to the camera, as some of them are beyond the Far clipping value of the projection matrix (causing them to not render).
The interpolated stars flow will only execute when a FPS setting above 20 is used, otherwise the original stars are rendered.
I did my best to calculate the math such that the interpolated stars are as close as possible in size/position to how the original stars were. Any remaining differences are largely just from texture rectangles "snapping" to whole integer values, where as quads have more precision.
smooth-stars.mp4
There is an additional bug fix to correct missing alpha fading on the stars when they appear/disappear. This required a similar "fix" that the bombers notebook needed for some of its elements.
Closes #492
Build Artifacts