LogoLogo
  • Get Started
  • Getting Started
    • Initial Setup
    • Create Your First Game
    • API Reference
    • Build Your First World Map
    • Multiplayer Testing
    • Use Templates & Examples
    • Styling & Assets
      • Modeling Guidelines
      • Texturing Guidelines
      • Default Assets
  • Build Faster With AI Tools
  • SDK Guides
    • Assets
    • Audio & SFX
      • Audio Manager
    • Blocks & Chunks
      • Block Types
      • Block Type Registry
      • Chunks
      • Chunk Lattice
    • Camera
    • Chat & Commands
    • Debugging
    • Entities
      • Animations
      • Block Entities
      • Colliders & Hitbox
      • Child Entities
      • Entity Controllers
        • Base Entity Controller
        • Pathfinding Entity Controller
        • DefaultPlayer Entity Controller
        • Simple Entity Controller
      • Entity Manager
      • Model Entities
      • Movement & Pathfinding
      • Player Controlled Entities
    • Events
    • Input & Controls
    • Lighting
      • Ambient Light
      • Light Manager
      • Point Lights
      • Spot Lights
      • Sun Light (Directional)
    • Mobile
    • Persisted Data
    • Players
      • Player Manager
      • Persisted Player Data
    • Plugins
    • Physics
      • Colliders
      • Collision Groups
      • Debugging
      • Gravity
      • Raycasts
      • Rigid Bodies
    • User Interface
      • Overlay UI
      • Scene UIs
      • Scene UI Manager
    • Worlds
      • Map Data Format
  • Helpful Resources
    • HYTOPIA Architecture & Platform Overview
    • Useful Third-Party Tools
Powered by GitBook
On this page
  • Color & Intensity
  • Diving Deeper
Export as PDF
  1. SDK Guides
  2. Lighting

Ambient Light

Ambient light is the base light that fills the entirety of a world, regardless of caves or other occluding elements. If you're using ambient light with the Sun Light (Directional light), you can think of ambient light as the minimum lighting in your world.

Color & Intensity

The ambient light allows you to control its color using an RGB value, and its intensity as a number.

The ambient light color and intensity can be changed anytime during gameplay to update the world's overall lighting.

Here's how we can change a world's ambient light color.

// ... other code
world.setAmbientLightColor({ r: 255, g: 0, b: 0 }); // very red ambient lighting

Here's how we can change a world's ambient light intensity. Ambient lighting intensity can be a value from 0 to 1+, with 1 being the default brightness, and anything above that being additional brightness.

// ... other code
world.setAmbientLightIntensity(20); // Very over-exposed, ultra bright lighting

You can use both the light color and intensity in combination to get your ambient lighting for a world.

Diving Deeper

The latest ambient lighting API Reference can be found as part of the World API Reference here.

If there are features that we don't currently support for ambient lighting that you'd like to see added to the HYTOPIA SDK, you can submit a feature request here.

PreviousLightingNextLight Manager

Last updated 5 months ago