Skip to content

Skyboxes (Golf 1.6.0 and above)

fallahn edited this page Jun 1, 2022 · 2 revisions

From version 1.6.0 the course definition file now refers to a skybox definition file instead of a cubemap definition. Previously the skybox property pointed to a ccm file, but the format has been updated so that it now contains a path to an sbf file, in crogine config file format:

skybox = "assets/golf/skyboxes/spring.sbf"

The new format renders a 3D scene behind the golf course using the standard crogine model format, at approximately 1/64 the scale of the golf course. This is then scaled up to match when rendered in game. Note that although the skybox is rendered as a 3D scene it is rendered completely independently from the main golf game - in other words depth testing is not available when rendering the golf course, so care should be taken when rendering objects that overlap. Think of the skybox as a green screen or projection screen in a TV studio - while it is fully 3D and camera matched with the on-going game action, the game actors cannot interact with what is essentially a flat background from their point of view.

The background scene should be approximately circular with a maximum radius of 10-14 world units. A minimum radius of 3 units or more should be left empty, as this is the area where the main golf scene will be drawn. The radius of the background scene should be centred around 0,0,0 in world coordinates. The modkit contains a Blender file named skybox.blend which contains helpers marking out the min/max radii, as well as Blender models used to create the existing 3D skyboxes used in the game. When exporting models from Blender and importing them into crogine they should be assigned an 'Unlit' material - see converting models for more information on how this works.

Once the models are exported and available in the assets/golf/models/ directory they can be referenced from the skybox definition file. This file has a very similar syntax to the hole defnition file, in fact prop models are declared the same way. There are also a few differences, however. The skybox file has the following layout:

skybox
{
    sky_top = 0.706,0.851,0.804,1
    sky_bottom = 0.937,0.678,0.612,1
    clouds = "assets/golf/sprites/clouds03.spt"

    prop
    {
        model = "assets/golf/models/skybox/horizon02.cmt"
        position = 0,0,0
        rotation = 0
        scale = 1,1,1
    }
}

Note that the first two properties state the colour of the sky. The sky_top property is a normalised RGBA colour which is used when rendering the main sky above the world. The sky_bottom colour is used to render the horizon, between the water colour and sky_top colour. If either of these properties are omitted the game will fall back to default colours.

The clouds property was previously defined in the course.data file, and has now been moved to the skybox definition file. It contains a path pointing to the sprite sheet containing the cloud sprites which are rendered across the top of the sky box (and move in the direction of the wind).

The prop object is the same layout as props used in the hole definition file, however if the rotation value is greater than 360 then the game will automatically animate the rotation of the model based on how much greater the value is above 360. For instance a value of 361 will animate the rotation of the model by 1 degree per second. This is only really useful for models which contain clouds, so that they appear to travel along the horizon.

As the prop object shares the same definition as existing prop data, other game models can be included in the skybox. However the scale should be set so that the model is rendered 1/64 or smaller, so that it is correctly proportionate to the skybox scene.

Clone this wiki locally