threejs-worldgen
    Preparing search index...

    Class Stars

    The star field and Milky Way. Created by Sky for you; use it directly for a space scene or a sky without atmosphere.

    const stars = new Stars({ seed: 7, magnitudeLimit: 8 })
    scene.add(stars.object)
    // each frame, optionally with a SkyState to turn the sky and fade with daylight:
    stars.update(state)
    Index
    • Parameters

      • input: StarsInput = {}

        Settings.

      • Optionaluniforms: {
            airglow: UniformNode<"color", Color>;
            airglowBand: UniformNode<"float", number>;
            airglowBandColor: UniformNode<"vec3", Vector3>;
            airglowShell: UniformNode<"vec3", Vector3>;
            atmosphereHeight: UniformNode<"float", number>;
            bodyMatrix: UniformNode<"mat3", Matrix3>;
            cameraToPlanet: UniformNode<"vec3", Vector3>;
            celestialMatrix: UniformNode<"mat3", Matrix3>;
            density: UniformNode<"float", number>;
            earthshine: UniformNode<"float", number>;
            groundColor: UniformNode<"color", Color>;
            mie: UniformNode<"float", number>;
            mieAbsorption: UniformNode<"float", number>;
            mieG: UniformNode<"float", number>;
            mieScaleHeight: UniformNode<"float", number>;
            moonAlbedoScale: UniformNode<"float", number>;
            moonAngularRadius: UniformNode<"float", number>;
            moonBrightness: UniformNode<"float", number>;
            moonDirection: UniformNode<"vec3", Vector3>;
            moonIllumination: UniformNode<"float", number>;
            moonMatrix: UniformNode<"mat3", Matrix3>;
            moonSkyIntensity: UniformNode<"float", number>;
            night: UniformNode<"float", number>;
            nightFloor: UniformNode<"float", number>;
            nightLights: {
                color: UniformNode<"vec3", Vector3>;
                density: UniformNode<"float", number>;
                intensity: UniformNode<"float", number>;
                map: TextureNode<"vec4">;
                planetRadius: UniformNode<"float", number>;
                scale: UniformNode<"float", number>;
                twilight: UniformNode<"vec3", Vector3>;
                useTexture: UniformNode<"float", number>;
            };
            ozone: UniformNode<"vec3", Vector3>;
            ozoneCenter: UniformNode<"float", number>;
            ozoneWidth: UniformNode<"float", number>;
            planetRadius: UniformNode<"float", number>;
            rayleigh: UniformNode<"vec3", Vector3>;
            rayleighScaleHeight: UniformNode<"float", number>;
            sunAngularRadius: UniformNode<"float", number>;
            sunColor: UniformNode<"color", Color>;
            sunDirection: UniformNode<"vec3", Vector3>;
            sunDiscIntensity: UniformNode<"float", number>;
            sunIntensity: UniformNode<"float", number>;
            up: UniformNode<"vec3", Vector3>;
        }

        Shared sky uniforms (from Sky). Omit for a standalone field: it then shows a fixed night sky until you pass a SkyState to Stars.update.

        • airglow: UniformNode<"color", Color>

          Faint night-sky glow (linear RGB radiance).

        • airglowBand: UniformNode<"float", number>

          Airglow shell brightness.

        • airglowBandColor: UniformNode<"vec3", Vector3>

          Airglow shell colour (linear).

        • airglowShell: UniformNode<"vec3", Vector3>

          Airglow shell bottom and top altitudes, metres (mesopause … Kármán line).

        • atmosphereHeight: UniformNode<"float", number>

          Atmosphere thickness, metres.

        • bodyMatrix: UniformNode<"mat3", Matrix3>

          Render → home planet body frame.

        • cameraToPlanet: UniformNode<"vec3", Vector3>

          Camera position minus planet centre, render space, metres.

        • celestialMatrix: UniformNode<"mat3", Matrix3>

          Render → star frame (fixed stars; turns with sidereal time).

        • density: UniformNode<"float", number>

          Density multiplier (0 = no atmosphere).

        • earthshine: UniformNode<"float", number>

          Earthshine radiance factor on the moon's dark side.

        • groundColor: UniformNode<"color", Color>

          Ground albedo seen through the atmosphere where no terrain is drawn (linear RGB).

        • mie: UniformNode<"float", number>

          Mie scattering per metre.

        • mieAbsorption: UniformNode<"float", number>

          Mie absorption per metre.

        • mieG: UniformNode<"float", number>

          Mie anisotropy.

        • mieScaleHeight: UniformNode<"float", number>

          Mie scale height, metres.

        • moonAlbedoScale: UniformNode<"float", number>

          Multiplier on the moon's albedo map.

        • moonAngularRadius: UniformNode<"float", number>

          Apparent moon radius, radians (0 = no moon).

        • moonBrightness: UniformNode<"float", number>

          Multiplier on the moon disc's sunlit radiance.

        • moonDirection: UniformNode<"vec3", Vector3>

          Towards the moon (render space).

        • moonIllumination: UniformNode<"float", number>

          Lit fraction of the moon.

        • moonMatrix: UniformNode<"mat3", Matrix3>

          Render → moon body frame.

        • moonSkyIntensity: UniformNode<"float", number>

          How strongly moonlight lights the sky, relative to the sun.

        • night: UniformNode<"float", number>

          0 by day … 1 at night. Bind it in your own materials (e.g. lit windows).

        • nightFloor: UniformNode<"float", number>

          Minimum light on the night side of the planet seen from altitude (fraction of sunIntensity).

        • nightLights: {
              color: UniformNode<"vec3", Vector3>;
              density: UniformNode<"float", number>;
              intensity: UniformNode<"float", number>;
              map: TextureNode<"vec4">;
              planetRadius: UniformNode<"float", number>;
              scale: UniformNode<"float", number>;
              twilight: UniformNode<"vec3", Vector3>;
              useTexture: UniformNode<"float", number>;
          }

          City lights on the night side.

          • color: UniformNode<"vec3", Vector3>

            Light colour (linear).

          • density: UniformNode<"float", number>

            Procedural coverage.

          • intensity: UniformNode<"float", number>

            Radiance of fully lit areas (0 = off).

          • map: TextureNode<"vec4">

            Lights texture (equirectangular).

          • planetRadius: UniformNode<"float", number>

            Planet radius, metres (sets the size of the sparkle).

          • scale: UniformNode<"float", number>

            Procedural feature scale.

          • twilight: UniformNode<"vec3", Vector3>

            Sun-elevation sines where lights switch on (start, full).

          • useTexture: UniformNode<"float", number>

            1 = use the texture, 0 = procedural.

        • ozone: UniformNode<"vec3", Vector3>

          Ozone absorption per metre (RGB).

        • ozoneCenter: UniformNode<"float", number>

          Ozone peak altitude, metres.

        • ozoneWidth: UniformNode<"float", number>

          Ozone layer half-width, metres.

        • planetRadius: UniformNode<"float", number>

          Planet radius, metres.

        • rayleigh: UniformNode<"vec3", Vector3>

          Rayleigh scattering per metre (RGB).

        • rayleighScaleHeight: UniformNode<"float", number>

          Rayleigh scale height, metres.

        • sunAngularRadius: UniformNode<"float", number>

          Apparent sun radius, radians.

        • sunColor: UniformNode<"color", Color>

          Sun disc colour from the star's temperature (linear RGB).

        • sunDirection: UniformNode<"vec3", Vector3>

          Towards the sun (render space).

        • sunDiscIntensity: UniformNode<"float", number>

          Sun disc radiance (HDR; drives bloom).

        • sunIntensity: UniformNode<"float", number>

          Sun radiance scale.

        • up: UniformNode<"vec3", Vector3>

          Local up at the camera (render space).

      Returns Stars

    milkyWay: {
        bulge: UniformNode<"float", number>;
        bulgeColor: UniformNode<"color", Color>;
        color: UniformNode<"color", Color>;
        detail: UniformNode<"float", number>;
        dust: UniformNode<"float", number>;
        galactic: UniformNode<"mat3", Matrix3>;
        intensity: UniformNode<"float", number>;
        offset: UniformNode<"vec3", Vector3>;
        width: UniformNode<"float", number>;
    } = ...

    Milky Way uniforms.

    Type Declaration

    • bulge: UniformNode<"float", number>

      Bulge brightness.

    • bulgeColor: UniformNode<"color", Color>

      Bulge colour (linear).

    • color: UniformNode<"color", Color>

      Disc colour (linear).

    • detail: UniformNode<"float", number>

      Noise frequency multiplier.

    • dust: UniformNode<"float", number>

      Dust lane strength.

    • galactic: UniformNode<"mat3", Matrix3>

      Star frame → galactic frame.

    • intensity: UniformNode<"float", number>

      Brightness (0 = off).

    • offset: UniformNode<"vec3", Vector3>

      Seeded noise offset.

    • width: UniformNode<"float", number>

      Band half-width, radians.

    object: Mesh<SphereGeometry, NodeMaterial>

    The far-dome mesh. Add it to your scene.

    settings: StarsOptions = ...

    Resolved settings. Change them with Stars.set / Stars.reset.

    starUniforms: {
        brightness: UniformNode<"float", number>;
        density: UniformNode<"float", number>;
        limit: UniformNode<"float", number>;
        palette: UniformNode<"vec3", Vector3>[];
        saturation: UniformNode<"float", number>;
        seed: UniformNode<"float", number>;
        size: UniformNode<"float", number>;
        twinkle: UniformNode<"float", number>;
        twinkleSpeed: UniformNode<"float", number>;
    } = ...

    Star-field uniforms.

    Type Declaration

    • brightness: UniformNode<"float", number>

      Brightness multiplier (0 = off).

    • density: UniformNode<"float", number>

      Density multiplier.

    • limit: UniformNode<"float", number>

      Effective limiting magnitude right now (after sky brightness).

    • palette: UniformNode<"vec3", Vector3>[]

      Black-body colours for 3200, 4300, 5500, 7000, 10000 and 20000 K.

    • saturation: UniformNode<"float", number>

      Tint saturation.

    • seed: UniformNode<"float", number>

      Seed folded into the cell hash.

    • size: UniformNode<"float", number>

      Size in pixels.

    • twinkle: UniformNode<"float", number>

      Twinkle strength.

    • twinkleSpeed: UniformNode<"float", number>

      Twinkle speed.

    uniforms: {
        airglow: UniformNode<"color", Color>;
        airglowBand: UniformNode<"float", number>;
        airglowBandColor: UniformNode<"vec3", Vector3>;
        airglowShell: UniformNode<"vec3", Vector3>;
        atmosphereHeight: UniformNode<"float", number>;
        bodyMatrix: UniformNode<"mat3", Matrix3>;
        cameraToPlanet: UniformNode<"vec3", Vector3>;
        celestialMatrix: UniformNode<"mat3", Matrix3>;
        density: UniformNode<"float", number>;
        earthshine: UniformNode<"float", number>;
        groundColor: UniformNode<"color", Color>;
        mie: UniformNode<"float", number>;
        mieAbsorption: UniformNode<"float", number>;
        mieG: UniformNode<"float", number>;
        mieScaleHeight: UniformNode<"float", number>;
        moonAlbedoScale: UniformNode<"float", number>;
        moonAngularRadius: UniformNode<"float", number>;
        moonBrightness: UniformNode<"float", number>;
        moonDirection: UniformNode<"vec3", Vector3>;
        moonIllumination: UniformNode<"float", number>;
        moonMatrix: UniformNode<"mat3", Matrix3>;
        moonSkyIntensity: UniformNode<"float", number>;
        night: UniformNode<"float", number>;
        nightFloor: UniformNode<"float", number>;
        nightLights: {
            color: UniformNode<"vec3", Vector3>;
            density: UniformNode<"float", number>;
            intensity: UniformNode<"float", number>;
            map: TextureNode<"vec4">;
            planetRadius: UniformNode<"float", number>;
            scale: UniformNode<"float", number>;
            twilight: UniformNode<"vec3", Vector3>;
            useTexture: UniformNode<"float", number>;
        };
        ozone: UniformNode<"vec3", Vector3>;
        ozoneCenter: UniformNode<"float", number>;
        ozoneWidth: UniformNode<"float", number>;
        planetRadius: UniformNode<"float", number>;
        rayleigh: UniformNode<"vec3", Vector3>;
        rayleighScaleHeight: UniformNode<"float", number>;
        sunAngularRadius: UniformNode<"float", number>;
        sunColor: UniformNode<"color", Color>;
        sunDirection: UniformNode<"vec3", Vector3>;
        sunDiscIntensity: UniformNode<"float", number>;
        sunIntensity: UniformNode<"float", number>;
        up: UniformNode<"vec3", Vector3>;
    }

    Sky uniforms read by the star shader (shared with Sky when created by it).

    Type Declaration

    • airglow: UniformNode<"color", Color>

      Faint night-sky glow (linear RGB radiance).

    • airglowBand: UniformNode<"float", number>

      Airglow shell brightness.

    • airglowBandColor: UniformNode<"vec3", Vector3>

      Airglow shell colour (linear).

    • airglowShell: UniformNode<"vec3", Vector3>

      Airglow shell bottom and top altitudes, metres (mesopause … Kármán line).

    • atmosphereHeight: UniformNode<"float", number>

      Atmosphere thickness, metres.

    • bodyMatrix: UniformNode<"mat3", Matrix3>

      Render → home planet body frame.

    • cameraToPlanet: UniformNode<"vec3", Vector3>

      Camera position minus planet centre, render space, metres.

    • celestialMatrix: UniformNode<"mat3", Matrix3>

      Render → star frame (fixed stars; turns with sidereal time).

    • density: UniformNode<"float", number>

      Density multiplier (0 = no atmosphere).

    • earthshine: UniformNode<"float", number>

      Earthshine radiance factor on the moon's dark side.

    • groundColor: UniformNode<"color", Color>

      Ground albedo seen through the atmosphere where no terrain is drawn (linear RGB).

    • mie: UniformNode<"float", number>

      Mie scattering per metre.

    • mieAbsorption: UniformNode<"float", number>

      Mie absorption per metre.

    • mieG: UniformNode<"float", number>

      Mie anisotropy.

    • mieScaleHeight: UniformNode<"float", number>

      Mie scale height, metres.

    • moonAlbedoScale: UniformNode<"float", number>

      Multiplier on the moon's albedo map.

    • moonAngularRadius: UniformNode<"float", number>

      Apparent moon radius, radians (0 = no moon).

    • moonBrightness: UniformNode<"float", number>

      Multiplier on the moon disc's sunlit radiance.

    • moonDirection: UniformNode<"vec3", Vector3>

      Towards the moon (render space).

    • moonIllumination: UniformNode<"float", number>

      Lit fraction of the moon.

    • moonMatrix: UniformNode<"mat3", Matrix3>

      Render → moon body frame.

    • moonSkyIntensity: UniformNode<"float", number>

      How strongly moonlight lights the sky, relative to the sun.

    • night: UniformNode<"float", number>

      0 by day … 1 at night. Bind it in your own materials (e.g. lit windows).

    • nightFloor: UniformNode<"float", number>

      Minimum light on the night side of the planet seen from altitude (fraction of sunIntensity).

    • nightLights: {
          color: UniformNode<"vec3", Vector3>;
          density: UniformNode<"float", number>;
          intensity: UniformNode<"float", number>;
          map: TextureNode<"vec4">;
          planetRadius: UniformNode<"float", number>;
          scale: UniformNode<"float", number>;
          twilight: UniformNode<"vec3", Vector3>;
          useTexture: UniformNode<"float", number>;
      }

      City lights on the night side.

      • color: UniformNode<"vec3", Vector3>

        Light colour (linear).

      • density: UniformNode<"float", number>

        Procedural coverage.

      • intensity: UniformNode<"float", number>

        Radiance of fully lit areas (0 = off).

      • map: TextureNode<"vec4">

        Lights texture (equirectangular).

      • planetRadius: UniformNode<"float", number>

        Planet radius, metres (sets the size of the sparkle).

      • scale: UniformNode<"float", number>

        Procedural feature scale.

      • twilight: UniformNode<"vec3", Vector3>

        Sun-elevation sines where lights switch on (start, full).

      • useTexture: UniformNode<"float", number>

        1 = use the texture, 0 = procedural.

    • ozone: UniformNode<"vec3", Vector3>

      Ozone absorption per metre (RGB).

    • ozoneCenter: UniformNode<"float", number>

      Ozone peak altitude, metres.

    • ozoneWidth: UniformNode<"float", number>

      Ozone layer half-width, metres.

    • planetRadius: UniformNode<"float", number>

      Planet radius, metres.

    • rayleigh: UniformNode<"vec3", Vector3>

      Rayleigh scattering per metre (RGB).

    • rayleighScaleHeight: UniformNode<"float", number>

      Rayleigh scale height, metres.

    • sunAngularRadius: UniformNode<"float", number>

      Apparent sun radius, radians.

    • sunColor: UniformNode<"color", Color>

      Sun disc colour from the star's temperature (linear RGB).

    • sunDirection: UniformNode<"vec3", Vector3>

      Towards the sun (render space).

    • sunDiscIntensity: UniformNode<"float", number>

      Sun disc radiance (HDR; drives bloom).

    • sunIntensity: UniformNode<"float", number>

      Sun radiance scale.

    • up: UniformNode<"vec3", Vector3>

      Local up at the camera (render space).

    • Turns and fades the field. Pass the Sky's state (or one from observe()); standalone fields can be called without arguments.

      Parameters

      Returns void