Fog
Updated
Distance fog over the whole scene.
- Type
comp-fog- Script class
FogComponent- Per entity
- One
- Version
- 1.1.0
Read about it in Environment and sky: what it does, how to use it from a script, and examples.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
density |
0 ≤ x ≤ 10 |
|
far |
0 ≤ x ≤ 100000 |
|
near |
0 ≤ x < 100000 |
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Fog that rolls inAn avenue of columns under a hazy sky: Fog closes in over four seconds when you press Fog and pulls back when you press Clear, with near and far tweened together on the scene root's Fog.
Press Fog and watch the far columns fade into the mist, then press Clear. Drag to orbit the camera, scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(FogComponent); if (component) log(component.props);}