Environmental Effects
rooomSpaces Viewer API environmental effects for immersive virtual spaces. Control fog, atmospheric conditions, and environmental rendering effects in 3D environments.
Are you an LLM? You can read better optimized documentation at /docs/rooom-spaces/viewer/viewer-api/effects.md for this page in Markdown format
updateFog
updateFog(options: object, [callback: Function])
Updates the fog effect in the virtual environment.
Parameters:
options: object- Fog configuration options (see FogOptions below)
Available Options:
fogStart?: number- Distance from camera where fog begins to appearfogEnd?: number- Distance where fog reaches maximum densitycolor?: [r: number, g: number, b: number]- RGB color values (0.0 to 1.0)
js
// Create mysterious morning fog
api.updateFog({
fogStart: 10,
fogEnd: 50,
color: [0.9, 0.9, 1.0] // Light blue-white
}, function() {
console.log('Morning fog effect applied');
});
// Create dramatic sunset atmosphere
api.updateFog({
fogStart: 5,
fogEnd: 30,
color: [1.0, 0.6, 0.3] // Warm orange
}, function() {
console.log('Sunset fog atmosphere created');
});
// Clear fog for crystal clear visibility
api.updateFog({
fogStart: 1000,
fogEnd: 2000,
color: [1.0, 1.0, 1.0] // White (minimal effect)
}, function() {
console.log('Fog cleared for maximum visibility');
});Best Practices
Visual Design:
- Match fog color to the overall lighting scheme
- Adjust fog density based on space size and purpose
Performance:
- Use fog to hide distant geometry and reduce rendering load
- Consider user preferences for visual effects