Programmatic / procedural skybox

I’ve searched around but can’t seem to find a definitive answer on if BabylonJS supports programmatic skyboxes. I had in mind to use a shader to render the scene, e.g. a sky gradient that can change color (from dawn, to mid day, dusk, night time), and a sun, moon and simple stars that can move around the sky. Perhaps using a giant sphere, to contain the camera and the contents, with a custom fragment shader or a node material would be a better idea?

At the moment I have a scene.clearColor of light blue but I would like to represent the passage of time a bit better than just dimming it down and brightening it up. Any thoughts or links to existing material is appreciated.

I’d really like to recreate this kind of thing if possible: Simulating the Colors of the Sky (Simulating the Colors of the Sky)




Babylon has a sky material.

Best. Werner


BabylonJS is incredible (and all the authors, researchers, coders who came before who made this possible!)


Is there a way to easily add a directional light and a hemispherical light? Both with the right intensity and colour? And the former with the right direction?

And secondly is there an existing library to rotate the sky box and to calculate that rotation and the sun inclination given a lattitude, longitude, date and time?

@yamaciller perhaps I should post this as a separate question?

ajp, give a thanks to @roland
.post RealSun - position your Star/Sun like a pro
.app BabylonJS RealSun example
.repo GitHub - RolandCsibrei/babylonjs-real-sun-moon


Phantastic examples. These I also didn’t know. Thank you.
I used that as a base for the environment.

The sun position we do on base of some script we used also in other engines.
Would need to ask our programmer :slight_smile:

But I guess these examples above are way more advanced so I hope that this is a source for you.

All the best.