@threlte/extras

<Sky>

This component adds a Three.js Sky object to the scene, renders that on-demand to a cubemap which is assigned to the default scene as the environment map.

Usage

<script lang="ts">
  import { T, Canvas } from '@threlte/core'
  import { Sky } from '@threlte/extras'
</script>

<Canvas>
  <Sky elevation={0.5} />

  <T.PerspectiveCamera
    makeDefault
    position={[0, 3, 18]}
    fov={60}
    oncreate={({ ref }) => {
      ref.lookAt(0, 0, 0)
    }}
  />
</Canvas>

Environment

By default, this component will render the sky to the scene environment. This can be disabled by setting the setEnvironment prop to false.

<Sky setEnvironment={false} />

Performance

The <Sky> component will only re-render the cubemap when the properties change.

Component Signature

Props

name
type
required
default

azimuth
number
no
180

cubeMapSize
number
no
128

elevation
number
no
2

mieCoefficient
number
no
0.005

mieDirectionalG
number
no
0.7

rayleigh
number
no
3

scale
number
no
1000

setEnvironment
boolean
no
true

turbidity
number
no
10

webGLRenderTargetOptions
number
no
{}