Better Skyboxes

For people working on the C++ code.
Post Reply
Jordach
Member
Posts: 4534
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach
Location: Blender Scene

Better Skyboxes

by Jordach » Post

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.

Sires
Member
Posts: 190
Joined: Mon Jan 02, 2017 21:00
GitHub: Sires0
IRC: Sires
In-game: Sires Sores Siri Seris or anything ppl call me
Location: :noitacoL

Re: Better Skyboxes

by Sires » Post

+1 but I suck at c++ ¯\_(ツ)_/¯
I don't have anything important to say.

User avatar
Inocudom
Member
Posts: 3121
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

Re: Better Skyboxes

by Inocudom » Post

Agreed. Skyboxes are very static right now. Anything that can give them animations and color changes is a welcome edition.

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: Better Skyboxes

by TumeniNodes » Post

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!
A Wonderful World

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Better Skyboxes

by Sokomine » Post

That's a beautiful sunset. Would love to see that implemented.
A list of my mods can be found here.

Jordach
Member
Posts: 4534
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach
Location: Blender Scene

Re: Better Skyboxes

by Jordach » Post

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

SFENCE
Member
Posts: 280
Joined: Sun Sep 29, 2019 07:13
GitHub: SFENCE
In-game: SFENCE

Re: Better Skyboxes

by SFENCE » Post

Looks great.

Can it be already used in mods?
cdb_3P0AYqjEIn68

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests