Sky Editor
Skies are still a work in progress. In future we will implement more sophisticated clouds, as well as jet trails and other high sky effects. Nevertheless there are some interesting features to play with, including sunsets, the moon, and a starfield. Note that you can pause the passage of time by hitting F5.The skies are stored in a file called /system/sky_cycle.lua. Have a look at this file and see what data there is. You can modify it manually and reload the game, or re-include the lua file from the console (Look the general documentation page for more info on loading/reloading files). However it is easier to use the interactive sky editor which is the subject of this wiki page.
The sky is morphed between various pre-set times. This allows a smooth transition throughout the day with only a few defined points in time. Currently you have to edit the sky_cycle.lua file manually to add / remove time points and change the times where they occur. This may be fixed in a later version.
Editor Basics
Enabling the Editor
While playing the game hit Ctrl+F5. Hitting Ctrl+F5 again returns you to the normal game mode. Changes are not lost unless you quit or explicitly reload the sky. When you hit Ctrl+F5 the time will be set to the nearest pre-set time. This makes it easier to edit, as what you see is only the sky at that point, not some sky that is formed by combining two different time points.GUI
The time of day is displayed as usual in the bottom right, near the FPS indicator. The bottom left of the screen should contain a basic textual interface telling you about the sky at the current time. There are many things that can be modified. Press the up and down arrow keys to cycle between them. The currently selected sky feature (you can only edit one thing at a time) is shown in red.Pick a time to modify
Use the left and right arrow keys to pick a time of day. You can modify any time of day and flick between them at your leisure. Changes will not be lost unless you quit the game or reinclude the sky_cycle.lua file.Gradients
The sky is coloured as follows: It is divided by 6 lines, 2 of which are fixed, one at the top (overhead) and one at the horizon, the rest you can position however you like between these two lines. Each line has a colour and the colour of the sky is formed by interpolating between the colour of the lines immediately above and below. Thus by changing the colour of the lines, you can create interesting smooth gradients for the whole sky.There is one gradient for areas near the sun ("sunGrad"), and one for the rest of the sky ("grad"). Both are modified using the same keys:
- If a line can be moved up and down, this is done with the 8 and 2 keys on the numeric keypad.
- The colour of a line is modified using 9 6 3, meaning more red green blue respectively, and 7 4 1, meaning less red green blue respectively. These numbers are also on the numeric keypad.
- Alpha is modified using 0 and the period on the numeric keypad.
- Hold down ctrl to slow down the rate of change (useful if you have low FPS). Less alpha means the stars will shine through.
Lighting
The sun / moon are positioned automatically depending on the time of day. They should be celestially accurate for summer time in the northern hemisphere. You can choose whether it is the sun or moon that lights the scene and casts shadows. This is done with the 5 key on the numeric keypad.Ambient, diffuse, and specular light are controlled, each RGB channel independently using the 147369 keys on the numeric keypad, just as with the sky lines. Fog colour is controlled this way too, but the strength of the fog is controlled with 0 and period, just like the alpha of the gradient lines.
Note that Grit can only render one shadow at a time, so the diffuse light needs to fade to black before the switch from sun to moon and vice versa occurs. When this happens you can use ambient lighting to avoid the scene being completely dark. In future we may allow the shadow to be faded using a separate control, so that a little diffuse light can still be used.
Sun Appearance
The appearance of the sun itself can be changed. The sunColour field is the colour of the sun itself, and the falloff (controlled with 8 and 2 on the numeric keypad) controls whether the sun is hazy or sharp. The sunSize speaks for itself and is controlled with 8 and 2 also.Recall that we defined two sky gradients — one for areas of the sky near the sun and one for areas of the sky far away. It can be controlled how much influence the sun has over its surrounding sky — in Grit this is called "glare'. There are two abstract shapes near the sun. Firstly, a wide loop extending up from the horizon under the sun, which is useful for sunsets. The height of this ("horizonGlareLevel") can be controlled using 2 and 8 on the numeric keypad. The other shape is a simple circle around the sun (much bigger than the circle of the sun itself). The radius of this can be controlled with 2 and 8 on the numeric keypad ("sunGlareRadius"). Note that if you have not chosen different colours for the sunGrad and grad lines near the horizon, you will not see any difference when you manipulate the horizonGlareLevel.
Saving and Loading
By default Grit comes with a /system/sky_cycle.lua file. You can overwrite this with your own sky if you want, or simply include a different sky_cycle.lua file in user_script.lua or at any time during execution to replace the sky. In order to save your editted sky to disk, type into the console:save_sky_cycle "my_dir/my_filename.lua"
You can specify whatever filename you like (within the Grit directory) or specify no filename in which case "saved_sky_cycle.lua" in the base of the Grit directory will be used:
save_sky_cycle()
To load the sky, just type in
include "/my_dir/my_filename.lua"
To load the default sky you can type
include "/system/sky_cycle.lua"
Category:Pipeline?
