Bitbybit Docs
    Preparing search index...

    Class BabylonMaterialSky

    A procedural daytime sky computed from atmosphere settings rather than an image: where the sun is, how hazy the air is and how bright the sky glows. Put the material on a large inside-out box or sphere around the scene and move the sun with inclination and azimuth, or with an explicit sunPosition.

    Index

    Constructors

    create

    • Creates a sky material from atmosphere settings; only the values you give are applied over the defaults.

      inclination from -0.5 to 0.5 lifts the sun from the horizon and azimuth from 0 to 1 turns it around the sky; turbidity adds haze and luminance sets the overall brightness.

      Parameters

      Returns SkyMaterial

      The sky material

      const sky = bitbybit.babylon.material.skyMaterial.create({ luminance: 1, turbidity: 10, rayleigh: 2, mieCoefficient: 0.005, mieDirectionalG: 0.8, distance: 500, inclination: 0.49, azimuth: 0.25, sunPosition: [0, 100, 100], useSunPosition: false, cameraOffset: [0, 0, 0], up: [0, 1, 0], dithering: false });
      const dome = bitbybit.babylon.meshBuilder.createSphere({ diameter: 1000, segments: 32, sideOrientation: Bit.Inputs.BabylonMesh.sideOrientationEnum.backside, enableShadows: false });
      bitbybit.babylon.mesh.setMaterial({ babylonMesh: dome, material: sky, includeChildren: false });

    get

    • Reads the overall brightness of a sky material.

      Parameters

      Returns number

      The luminance

    • Reads how hazy a sky material's air is.

      Parameters

      Returns number

      The turbidity

    • Reads the Rayleigh scattering strength of a sky material, the setting behind its blue.

      Parameters

      Returns number

      The Rayleigh value

    • Reads how much haze a sky material has around the sun.

      Parameters

      Returns number

      The Mie coefficient

    • Reads how tightly a sky material's haze glow gathers around the sun.

      Parameters

      Returns number

      The Mie directional value

    • Reads how far the sky dome sits from the camera in a sky material.

      Parameters

      Returns number

      The distance

    • Reads how high the sun stands in a sky material, from -0.5 to 0.5.

      Parameters

      Returns number

      The inclination

    • Reads where around the horizon the sun stands in a sky material, from 0 to 1.

      Parameters

      Returns number

      The azimuth

    • Reads the sun direction of a sky material; when useSunPosition is off it reflects the inclination and azimuth.

      Parameters

      Returns Vector3

      The sun position vector

    • Reads whether a sky material places the sun from sunPosition rather than from inclination and azimuth.

      Parameters

      Returns boolean

      True when the explicit sun position is used

    • Reads whether a sky material dithers its gradients to hide color banding.

      Parameters

      Returns boolean

      True when dithering is on

    set

    • Changes the overall brightness of a sky material, between 0 and 1.

      Parameters

      Returns void

    • Changes how hazy a sky material's air is; more haze whitens the sky and spreads the sun's glow.

      Parameters

      Returns void

    • Changes how strongly a sky material scatters light in the way that makes a clear sky blue; higher is a deeper, brighter blue.

      Parameters

      • inputs: RayleighDto

        The material and the Rayleigh value

      Returns void

    • Changes how much haze a sky material has around the sun, between 0 and 0.1; more makes a wider, whiter glow.

      Parameters

      Returns void

    • Changes how tightly a sky material's haze glow gathers around the sun; values near 1 make a small bright halo, lower values spread it.

      Parameters

      Returns void

    • Changes how far the sky dome sits from the camera in a sky material, which changes how the horizon reads.

      Parameters

      Returns void

    • Changes how high the sun stands in a sky material, from -0.5 below the horizon through 0 at the horizon to 0.5 overhead; ignored while useSunPosition is on.

      Parameters

      Returns void

      bitbybit.babylon.material.skyMaterial.setInclination({ material: sky, inclination: 0.1 });
      
    • Changes where around the horizon the sun stands in a sky material, from 0 to 1 for a full turn; ignored while useSunPosition is on.

      Parameters

      Returns void

    • Places the sun of a sky material at an explicit direction vector; it takes effect only while useSunPosition is on, otherwise inclination and azimuth decide.

      Parameters

      Returns void

      bitbybit.babylon.material.skyMaterial.setUseSunPosition({ material: sky, useSunPosition: true });
      bitbybit.babylon.material.skyMaterial.setSunPosition({ material: sky, sunPosition: [0, 50, 100] });
    • Chooses whether a sky material places the sun from sunPosition, when true, or from inclination and azimuth, when false.

      Parameters

      Returns void

    • Shifts the horizon of a sky material by an offset vector, so the sky can sit higher or lower relative to the camera.

      Parameters

      Returns void

    • Changes which direction a sky material treats as up, normally [0, 1, 0]; change it for scenes that use another axis as up.

      Parameters

      • inputs: UpDto

        The material and the up vector

      Returns void

    • Turns dithering on or off for a sky material; on, it adds fine noise that hides color banding in smooth gradients.

      Parameters

      Returns void