cocos_set_fog
Configure volumetric fog in Cocos Creator scenes by setting fog type, color, density, and range parameters to create atmospheric effects.
Instructions
Configure volumetric fog on the scene's cc.FogInfo.
Fourth scene-global alongside ambient/skybox/shadows. Lazy-creates a cc.FogInfo + links it from cc.SceneGlobals if the scene doesn't have one yet (scenes built before this tool existed won't).
fog_type: 0=LINEAR (use start+end), 1=EXP (density), 2=EXP_SQUARED, 3=LAYERED (top+range). Atmospheric settings are inter-dependent — LINEAR ignores density, EXP/EXP_SQUARED ignore start/end.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"scene_path": "<scene_path>"
},
"name": "cocos_set_fog"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| enabled | No | ||
| fog_type | No | ||
| color_r | No | ||
| color_g | No | ||
| color_b | No | ||
| color_a | No | ||
| density | No | ||
| start | No | ||
| end | No | ||
| atten | No | ||
| top | No | ||
| fog_range | No | ||
| accurate | No |