Page 1 of 1

Better Skyboxes

Posted: Wed Jan 24, 2018 19:27
by Jordach
I've been thinking of a way to improve the skyboxes we have now.

Introduction of skybox texture overlays:

Currently, we have:

Code: Select all

player:set_sky("#ffffff", "dynamic")
and

Code: Select all

player:set_sky("#ffffff", "skybox", 
    {
        "texture_top.png",
        "texture_bottom.png",
        "texture_left.png",
        "texture_right.png",
        "texture_back.png",
        "texture_front.png"
    })
Note that "#ffffff" is ignored by the engine (as far as atmos is concerned, see https://github.com/Jordach/Solar_Plains ... t.lua#L168 ), unless "skybox" is used as the set_sky option.

The expansion I'm thinking of is:

Code: Select all

player:set_sky("#fog?", "dynamic", -- fog should be determined from the horizon tonemap
    { -- overlay skybox textures with transparency above the stars
        "top.png",
        "bottom.png",
        "left.png",
        "right.png",
        "back.png",
        "front.png"
    }
    { -- overlay skybox with transparency behind the stars (to show the dynamic skybox)
        "top.png",
        "bottom.png",
        "left.png",
        "right.png",
        "back.png",
        "front.png"
    }
    { -- control the tonemaps for the sky colours to blend.
        "tonemap_top.png", -- sets the sky colour when you look up
        "tonemap_bottom.png", -- the sky colour when you look down
        "tonemap_mid.png", -- the horizon sky colour
        "tonemap_star_brightness.png", -- how bright are the stars in the sky?
        "tonemap_star_colour.png", -- what colour are these stars? (use the existing 16x16 palette system for nodes)
        "tonemap_star_time.png" -- can we see these stars during the day (may not be used, see the first star option.)
        "tonemap_skybox_front.png" -- control the opacity of the first skybox table
        "tonemap_skybox_rear.png" -- control the opacity of the second skybox table
    })
The two expanded areas are overlays for the dynamic skybox to have their own rotating textured skyboxes.

The new part allows tonemap control of star colours, star brightness (and when they'll appear.), and sky colours.

I've made a few mockups to show what this would look like, these are not part of the engine:

Image Sunset with Sun tonemap enabled.

Image Winter dusk with stars.

Image Nebula on a cloudless night.

Uses:

A skybox where the skies have visible moons / planets may exist and obscure the dynamic starfield..

A nebulae that hangs in the background and is only visible at night.

Changing the skybox tonemaps to simulate seasonal changes.

Having astronomical events in the sky, etc.

Couple of notes:

The overlaid skyboxes must rotate with the dynamic sky, otherwise, it'll look pointless to have.

Supplying "" or nil to a tonemap will use the default dynamic skybox settings.

The format for these may have to change, but RBA's tonemap topic is a good start:

viewtopic.php?p=150727

To finish:

RBA implemented sun and moon tonemaps a while ago, why not extend them and their feature set to the rest of the skybox?

Edits: Jeez BBCode has crap formatting.

Re: Better Skyboxes

Posted: Thu Jan 25, 2018 12:43
by Sires
+1 but I suck at c++ ¯\_(ツ)_/¯

Re: Better Skyboxes

Posted: Thu Jan 25, 2018 20:28
by Inocudom
Agreed. Skyboxes are very static right now. Anything that can give them animations and color changes is a welcome edition.

Re: Better Skyboxes

Posted: Thu Jan 25, 2018 20:38
by TumeniNodes
Beautiful mock-ups Jordach

one of my thoughts has been to work out being able to use animated sun and moon textures, which could:
add animated rays, or aura around the sun, or even particles which could rotate around it

allow for moon phases, as well as potentially adding types of moons, depending on seasonal/atmospheric changes

I know, it all sounds whacky but, I can dream ; )

Did you make a PR? I wanna thumb it up!

Re: Better Skyboxes

Posted: Sun Jan 28, 2018 01:48
by Sokomine
That's a beautiful sunset. Would love to see that implemented.

Re: Better Skyboxes

Posted: Thu Aug 16, 2018 22:44
by Jordach
Apologies for the bump, but I've gone and merged textured skyboxes with the sun, moon and stars.

Rubenwardy has suggested I expand the current skybox API into something more profound, with most of the features listed up in the first post.

Code: Select all

skybox = {
    skybox = { "texture_1.png", "texture_2.png", "texture_3.png", "texture_4.png", "texture_5.png", "texture_6.png",},
    clouds = true, -- clouds are enabled by default when not listed
    custom_fog = true, -- MT default fog (false) or custom fog (true)?

    sun = {
        visible = true,
        yaw = 90,
        tilt = 0,
        texture = "sun.png",
        sunrise_glow = true, -- Show the sunrise and set glow texture?
    },

    moon = {
        visible = true,
        yaw = 90,
        tilt = 0,
        texture = "moon.png",
    },

    stars = {
        visible = true,
        number = 200,
    },
}
Here's a visual demonstration that actually works.

Image

Image

Re: Better Skyboxes

Posted: Sat Apr 18, 2020 17:01
by SFENCE
Looks great.

Can it be already used in mods?