This guide walks you through creating realistic moonlight in Unreal Engine 4, covering directional lights, sky atmospheres, post-processing, and materials. Perfect for game developers and environment artists aiming for immersive night scenes.
Key Takeaways
- Use a Directional Light for moonlight: Simulate the moon’s distant light source with a directional light set to a cool, bluish color and low intensity.
- Adjust Sky Atmosphere and Exponential Height Fog: These systems enhance realism by scattering light and adding depth to night environments.
- Fine-tune Post-Process Volumes: Control exposure, contrast, and color grading to make moonlight feel natural and atmospheric.
- Use Emissive Materials for Glow Effects: Add subtle glow to surfaces like water or windows to mimic moonlight reflection.
- Test in Different Times of Day: Use the Time of Day system to animate moonlight and see how it interacts with your scene dynamically.
- Optimize Performance: Use Lightmass settings and LODs to keep your moonlit scene running smoothly without sacrificing visual quality.
- Troubleshoot Common Issues: Fix problems like overexposure, flat lighting, or missing shadows with targeted adjustments.
How to Have Moon Light in Unreal Engine 4
Creating a convincing nighttime scene in Unreal Engine 4 (UE4) can transform your environment from ordinary to magical. One of the most powerful tools in achieving this is realistic moonlight. Whether you’re building a horror game, a serene landscape, or a cinematic sequence, moonlight adds mood, depth, and immersion.
In this comprehensive guide, you’ll learn exactly how to have moon light in Unreal Engine 4. We’ll cover everything from setting up the right light source to fine-tuning post-processing effects and materials. By the end, you’ll be able to create stunning, believable night scenes that feel alive under the glow of a full moon.
This guide is designed for beginners and intermediate users. You don’t need to be a lighting expert—just follow the steps, and you’ll see real results. Let’s dive in.
Step 1: Set Up Your Scene for Nighttime
Visual guide about How to Have Moon Light in Unreal Engine 4
Image source: gfxfather.com
Before adding moonlight, make sure your scene is ready for nighttime. A daytime scene with bright sunlight won’t work well with moonlight. You need to create a dark base so the moonlight can stand out.
Switch to Night Mode in the Sky Atmosphere
Unreal Engine 4 includes a built-in Sky Atmosphere system that simulates realistic sky colors based on time of day. To get started:
- Open your level in the editor.
- Go to the Modes panel (top-left), select Visual Effects, and drag a Sky Atmosphere into your scene.
- Select the Sky Atmosphere actor in the viewport.
- In the Details panel, find the Sun Position section.
- Set the Sun Source to None or adjust the Time of Day slider to a nighttime value (e.g., 22:00 or 2:00 AM).
This will darken the sky and remove the sun’s glow, creating a perfect canvas for moonlight.
Disable or Remove the Directional Light (Temporarily)
If you already have a Directional Light in your scene (usually representing the sun), you’ll want to disable it while setting up moonlight.
- Select the Directional Light in your scene.
- In the Details panel, uncheck Visible or set Intensity to 0.
We’ll replace this with a moonlight later, so don’t delete it—just turn it off for now.
Step 2: Add a Directional Light for Moonlight
The moon is far away, so its light behaves like a directional source—similar to the sun, but much dimmer and cooler in color.
Create a New Directional Light
- Go to the Modes panel, select Lights, and drag a Directional Light into your scene.
- Name it “MoonLight” for clarity.
- Position it high above your scene, pointing downward at an angle (like the real moon).
Adjust Light Settings for Realism
Now, let’s tweak the settings to make it look like moonlight:
- Intensity: Set to around 0.1 to 0.3. Moonlight is much weaker than sunlight. Start with 0.2 and adjust based on your scene.
- Light Color: Use a cool, bluish-white color. Try RGB values like (180, 200, 255) or use a color picker to select a soft blue.
- Temperature: Alternatively, set the Temperature to around 6500–7500K for a natural moonlight feel.
- Cast Shadows: Make sure Cast Shadows is enabled. Moonlight should cast soft, subtle shadows.
- Shadow Bias: If shadows look pixelated or noisy, increase Shadow Bias slightly (e.g., 0.2–0.5).
Angle and Direction Matter
The angle of your moonlight affects the mood. A low angle (like a moon near the horizon) creates long, dramatic shadows. A high angle (moon overhead) gives even, soft lighting.
Try rotating the light to match the time of night you’re simulating. For a midnight scene, point it straight down. For a late evening or early morning moon, angle it slightly.
Step 3: Enhance the Sky and Atmosphere
Moonlight doesn’t travel through empty space—it scatters in the atmosphere, creating soft glows and depth. UE4’s Sky Atmosphere and Exponential Height Fog help simulate this.
Tweak the Sky Atmosphere
With your Sky Atmosphere selected:
- Rayleigh Scattering: This controls how blue light scatters. Increase slightly (e.g., 1.2) to enhance the blue tint of moonlight in the sky.
- Mie Scattering: Keep this low (0.005–0.01) to avoid hazy or foggy skies unless you want that effect.
- Ground Albedo: Set to a dark color (e.g., dark gray or black) to prevent the ground from reflecting too much light and washing out the night feel.
Add Exponential Height Fog
Fog adds depth and makes moonlight feel more atmospheric.
- Go to Modes > Visual Effects and add an Exponential Height Fog actor.
- Select it and go to the Details panel.
- Set Fog Density to a low value (e.g., 0.01–0.03). Too much fog will make the scene look muddy.
- Set Fog Inscattering Color to a very dark blue or purple (e.g., RGB 30, 40, 80). This gives the fog a nighttime tint.
- Enable Volumetric Fog for a more realistic glow around light sources.
Volumetric fog is especially effective for moonlight—it creates a soft beam of light when the moon is visible through trees or windows.
Step 4: Use Post-Process Volumes for Mood and Balance
Post-processing is where moonlight truly comes alive. It helps balance exposure, color, and contrast so the scene feels natural—not too dark or too bright.
Add a Post-Process Volume
- Go to Modes > Visual Effects and add a Post Process Volume.
- Check Unbound so it affects the entire level.
Adjust Key Settings
Here are the most important settings for moonlight:
- Exposure: Set Min Brightness to -3 or -4 and Max Brightness to 0 or 1. This prevents the scene from being too dark or blown out.
- Contrast: Increase slightly (e.g., 1.1–1.3) to add depth without losing detail.
- Saturation: Reduce to 0.8–0.9. Night scenes should feel less colorful.
- Color Grading: Use a cool tone. In the Color Grading section, shift the Temperature toward blue (e.g., -10 to -20).
- Vignette: Add a subtle vignette (0.2–0.4) to draw focus to the center of the screen.
Use LUTs for Cinematic Looks
Look-Up Tables (LUTs) can give your moonlight a cinematic feel. You can find free LUTs online or create your own.
- In the Post-Process Volume, find Color Grading LUT.
- Click the folder icon and select a LUT texture.
- Adjust LUT Blend to control intensity (start with 0.5).
A cool-toned LUT with muted colors works best for moonlight.
Step 5: Add Emissive Materials for Glow Effects
Moonlight doesn’t just illuminate—it reflects. Use emissive materials to simulate this glow on surfaces like water, windows, or metal.
Create a Glowing Water Material
- Right-click in the Content Browser and create a new Material.
- Open it and set Shading Model to Unlit or Default Lit with Emissive enabled.
- Add a Scalar Parameter named “GlowIntensity” and connect it to the Emissive Color input.
- Set the base color to a soft blue (e.g., RGB 100, 150, 255).
- Apply the material to a plane or water mesh in your scene.
Adjust the GlowIntensity to make the water shimmer under moonlight.
Use Light Functions for Subtle Effects
Light Functions let you project textures or patterns onto surfaces using light.
- Create a Texture (e.g., a soft gradient or noise pattern).
- In the Directional Light (MoonLight), find Light Function.
- Assign your texture and adjust Scale and Intensity.
This can simulate moonlight filtering through trees or clouds.
Step 6: Animate Moonlight with Time of Day
For dynamic scenes, use the Time of Day system to animate moonlight.
Use a Timeline or Blueprint
- Create a Blueprint (e.g., Level Blueprint or a custom actor).
- Add a Timeline node.
- Create a float track that controls the Directional Light’s rotation over time.
- Set keyframes to rotate the light from one side of the sky to the other (like the moon rising and setting).
- Adjust the timeline duration (e.g., 60 seconds for a fast cycle or 600 seconds for realism).
You can also link the light’s intensity and color to the timeline for a full day-night cycle.
Sync with Sky Atmosphere
Make sure your Sky Atmosphere’s Time of Day matches the light’s movement. Use a Set Sun Source node in Blueprints to update the sun (or moon) position dynamically.
Step 7: Optimize Performance
Moonlit scenes can be heavy on performance, especially with volumetric fog and shadows.
Adjust Lightmass Settings
- Go to Build > Lighting Quality and choose Production or Preview.
- In the Directional Light, find Lightmass settings.
- Increase Indirect Lighting Quality to 2–3 for better bounce light.
- Set Num Sky Lighting Rays to 32–64 for smoother sky lighting.
Use LODs and Culling
- Enable Level of Detail (LOD) on static meshes to reduce polygon count at a distance.
- Use Distance Culling to hide small objects far from the camera.
- Limit the number of dynamic lights—stick to one Directional Light for moonlight.
Test on Target Hardware
Always test your scene on the hardware you’re targeting (PC, console, mobile). Lower settings may be needed for mobile devices.
Troubleshooting Common Issues
Even with careful setup, you might run into problems. Here’s how to fix them.
Problem: Scene Is Too Dark
- Increase the Directional Light’s Intensity slightly.
- Lower the Exposure Min Brightness in Post-Process Volume.
- Add a faint Sky Light with low intensity to fill in shadows.
Problem: Shadows Are Too Harsh or Noisy
- Increase Shadow Bias in the Directional Light.
- Use Cascaded Shadow Maps (CSM) with higher resolution.
- Enable Contact Shadows for fine detail.
Problem: Moonlight Looks Yellow or Warm
- Check the light’s Color or Temperature—it should be cool (blue-white).
- Adjust the Post-Process Color Grading to reduce warm tones.
Problem: Fog Looks Too Thick or Artificial
- Lower Fog Density in Exponential Height Fog.
- Reduce Volumetric Fog intensity.
- Use a darker Fog Inscattering Color.
Problem: Performance Drops
- Disable Volumetric Fog if not needed.
- Reduce Shadow Map Resolution.
- Use Static Lighting instead of dynamic where possible.
Conclusion
Adding realistic moonlight in Unreal Engine 4 is all about balance. You need the right light source, atmospheric effects, post-processing, and materials working together. Start with a cool, dim Directional Light. Enhance it with Sky Atmosphere and fog. Fine-tune the mood with post-process volumes. And don’t forget to optimize for performance.
With these steps, you can create breathtaking night scenes that feel immersive and alive. Whether you’re building a game, a film, or a virtual experience, moonlight can elevate your work to the next level.
Remember: moonlight isn’t just about brightness—it’s about mood, color, and subtlety. Take your time, experiment, and trust your eyes. The best moonlight feels natural, not forced.
Now go light up the night.