Add rotation attribute to the ProceduralSky script - #9150
Merged
Conversation
Turns the whole sky around Y by adding the angle to the sun azimuth, so the sky, the sun, the moon, the sun light and its shadows all turn together, leaving the azimuth and elevation a day / night cycle animates untouched.
Build size reportThis PR does not change the size of the minified bundles.
|
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.
The ProceduralSky script drives the sky from a sun azimuth and elevation, which a day / night cycle typically animates. There was no way to orient the resulting sky over a scene without reaching into that mapping - offsetting the azimuth a cycle is writing every frame means the cycle no longer means what it says.
This adds a single angle that turns the whole sky around Y instead. It is added to the sun azimuth internally, so the sky, the sun, the sun light and the shadows it casts all turn together, and the azimuth / elevation an application animates keep their meaning. The moon direction turns with it too, so the moon and the night key light hold their place relative to the sun's path.
The only part not turned by it is the procedural star field, which stays anchored to the world axes - not observable, as the stars are noise to begin with. The existing lighting re-bake triggers itself off the sun direction, so nothing extra is needed to keep the image based lighting in sync.
Changes:
rotationattribute, in degrees, applied in_computeSunDir_computeMoonDir, used by both the moon disc uniform and the night key light, so the moon turns with the skyAPI Changes:
ProceduralSky#rotation- number, degrees, range 0-360, defaults to 0 (no rotation), so existing behaviour is unchangedExamples:
graphics/procedural-sky- added a Rotation slider to the Sky panel