Stop Lighting Your Island Like a Campfire: Master Rectangular Area Lights
Tutorial beginner

Stop Lighting Your Island Like a Campfire: Master Rectangular Area Lights

Updated beginner

Stop Lighting Your Island Like a Campfire: Master Rectangular Area Lights

You know that feeling when you place a light in Fortnite, and it looks like a single lightbulb in a gymnasium? Harsh, pointy, and casts shadows that look like they were drawn with a ruler. Now imagine you’re building a moody interrogation room, a cozy café, or a high-tech studio. You need light that flows, not just shines. Enter the Rectangular Area Light (or RectLight for short). It’s the difference between "I threw some props down" and "I actually designed a scene."

In this tutorial, we’re going to ditch the pointy, harsh lighting and learn how to use Verse to dynamically control rectangular lights. We’ll build a "Mood Switch" island where you can toggle between a harsh, interrogator-style spotlight and a soft, cinematic overhead glow with a single button press.

What You'll Learn

  • The Scene Graph: How Verse attaches lighting properties to objects (entities) in your world.
  • RectLight Components: What they are and why they make shadows look "real."
  • Dynamic Toggling: Using Verse to change light intensity and color in real-time.
  • Shadows & Softness: How the size of your light affects the "feel" of your island.

How It Works

The Scene Graph: Your Island’s Skeleton

Before we write code, we need to understand where the light lives. In Fortnite Creative, everything is an Entity (an object in the world, like a wall, a player, or a light). In Verse, we manipulate these entities using the Scene Graph. Think of the Scene Graph as a family tree or a hierarchy. A light isn’t just "there"; it’s a Component attached to an Entity.

If you were building a house, the Entity is the house, and the light is a window. You can’t have a window floating in the void; it needs to be attached to a wall (or in this case, a light fixture entity). When we write Verse, we are reaching into that hierarchy and tweaking the knobs on the window.

RectLight vs. Point Light: The "Campfire" Effect

A standard Point Light acts like a single bulb. It gets very bright right next to it and fades out quickly. Shadows are sharp and hard-edged. This is great for a flashlight, but terrible for lighting a whole room evenly.

A Rectangular Area Light acts like a large panel or a window. It emits light from a surface area, not a single point. This creates Diffuse Lighting.

  • Soft Shadows: Because the light comes from a wide area, shadows have "penumbras" (soft edges) rather than hard, black lines. It mimics how light behaves in the real world (like light coming through a large window).
  • Even Coverage: It lights up large flat surfaces (like a ceiling or a floor) much more naturally than a point light.

The Verse Connection

In UEFN, you can place a RectLight actor manually. But what if you want the light to change? What if you want the room to go from "Bright Studio" to "Dim Lounge" when a player steps on a trigger? That’s where Verse comes in. We use the rect_light_component class to grab that light actor and change its properties (like Intensity or Color) on the fly.

Let's Build It

We are going to build a simple "Mood Room." It will have two RectLights:

  1. The Interrogator: A harsh, bright, white light.
  2. The Vibes: A softer, warmer, dimmer light.

We will use Verse to toggle between them when a player presses a button.

Step 1: Set Up the Scene

  1. Open UEFN and create a new Island.
  2. Place a simple room (a box with a floor, ceiling, and walls).
  3. Place two Lighting Actor - Rectangular Light objects in the center of the room.
    • Name the first one InterrogatorLight.
    • Name the second one VibesLight.
  4. In the Details Panel for InterrogatorLight:
    • Set Intensity to 1000 (or higher).
    • Set Color to White.
    • Make sure Cast Shadows is checked.
  5. In the Details Panel for VibesLight:
    • Set Intensity to 200.
    • Set Color to a warm orange/yellow.
    • Make sure Cast Shadows is checked.
  6. Place a Button actor somewhere in the room. Name it MoodButton.

Step 2: The Verse Code

Now, let’s write the script. This script will "listen" for the button press and swap the lighting.

Create a new Verse file in your project (e.g., mood_lighting.verse) and paste this code:

using { /Engine/Engine }
using { /Verse.org/Simulation }
using { /Verse.org/Simulation }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Devices }
using { /Engine/SceneGraph }

# This is our main script. It runs on the island.
# Think of it as the game director controlling the lights.
mood_lighting := class(creative_object):
    # We need to reference the button and the two lights.
    # These are "variables" that hold pointers to our actors.
    MoodButton: button_device = ?
    InterrogatorLight: creative_object = ?
    VibesLight: creative_object = ?

    # This function runs when the island starts.
    # It's like loading the map.
    OnBegin<override>()<suspends>: void =
        # First, we check if we actually have the button and lights.
        # If not, we stop and yell at the user (in logs).
        if MoodButton == ? or InterrogatorLight == ? or VibesLight == ?
            print("Error: Missing Button or Lights! Check your names.")
            return
        
        # Now, we tell the Button: "When you are pressed, run this code."
        # This is called "binding an event."
        MoodButton.OnButtonPressed.Bind<override>(
            func (pressed_button: button_device): void =
                ToggleLights()
            )

    # This is the function that does the actual work.
    ToggleLights<override>()<suspends>: void =
        # We need to get the actual light components from the creative objects.
        # A creative_object is just a container. The light is inside it.
        # We use 'GetComponents' to find the rect_light_component.
        
        # Get the Interrogator's light component
        interrogator_light_comp := InterrogatorLight.GetComponents<rect_light_component>()
        
        # Get the Vibes light component
        vibes_light_comp := VibesLight.GetComponents<rect_light_component>()
        
        # If we couldn't find the components, stop.
        if interrogator_light_comp == [] or vibes_light_comp == []
            print("Error: Could not find RectLight components!")
            return
        
        # Get the first (and only) light component from the list
        interrogator_light := interrogator_light_comp[0]
        vibes_light := vibes_light_comp[0]
        
        # Now, let's check the current state. 
        # We'll use a simple boolean flag to track if we are in "Interrogation" mode.
        # For simplicity, we'll just toggle based on a static variable.
        # Note: In a real complex game, you might store this state in a class variable.
        
        # Let's assume we start in Interrogation mode.
        # We will toggle by swapping intensities.
        
        # Get current intensity of Interrogator
        current_interrogator_intensity := interrogator_light.GetIntensity()
        
        # If Interrogator is bright, turn it off and turn Vibes on.
        # If Interrogator is dim, turn it on and turn Vibes off.
        
        if current_interrogator_intensity > 500
            # Switch to Vibes Mode
            interrogator_light.SetIntensity(0.0)
            vibes_light.SetIntensity(500.0)
            print("Switched to Vibes Mode")
        else
            # Switch to Interrogation Mode
            interrogator_light.SetIntensity(1000.0)
            vibes_light.SetIntensity(0.0)
            print("Switched to Interrogation Mode")

Walkthrough: What Just Happened?

  1. using Statements: These are like loading your inventory. We need SceneGraph to talk to the lights, Simulation to make things happen over time, and Devices to talk to the Button.
  2. class(creative_object): This defines our script. It’s a container for our logic.
  3. MoodButton: button_device = ?: This is a variable. We initialize it with ? (null) because we don’t know which button it is yet. We’ll connect it in the editor.
  4. OnBegin: This function runs once when the game starts. It’s our setup phase.
    • We bind MoodButton.OnButtonPressed to our ToggleLights function. This means "When the button is clicked, run ToggleLights."
  5. ToggleLights: This is the brain.
    • Getting Components: InterrogatorLight.GetComponents<rect_light_component>() looks inside the InterrogatorLight actor and finds the actual light data. It returns a list (array) because an object can have multiple lights, so we grab [0] (the first one).
    • SetIntensity: This is the magic command. It changes how bright the light is in real-time.
    • The Logic: We check if the Interrogator light is currently bright. If it is, we turn it off (0.0) and turn the Vibes light up. If it’s off, we do the reverse.

Why This Is Better Than Just Placing Lights

If you just placed two lights and set their intensity in the editor, you’d have two lights always on, or you’d have to build a complex trigger system with no-code devices. Verse gives you programmatic control. You can easily add more modes (e.g., "Red Alert" mode with red lights) by adding a few lines of code, without touching the editor’s lighting settings again.

Try It Yourself

Challenge: Modify the code to add a third "Red Alert" mode.

  1. Place a third RectLight in the room and name it AlertLight.
  2. Set its color to bright red and intensity to 800.
  3. Update the Verse code to cycle through three modes:
    • Mode 1: Interrogator (White, High Intensity)
    • Mode 2: Vibes (Orange, Low Intensity)
    • Mode 3: Red Alert (Red, High Intensity)
  4. Hint: You’ll need to track the current mode (maybe using an integer variable like current_mode: int = 1) and increment it each time the button is pressed. If it goes above 3, reset it to 1.

Don’t forget: When you get the components for AlertLight, make sure to set its intensity to 0.0 when it’s not the active mode!

Recap

  • Rectangular Area Lights create soft, natural lighting and smooth shadows, unlike harsh point lights.
  • The Scene Graph is how Verse accesses and modifies objects in your world.
  • rect_light_component is the specific tool you use to change light properties like intensity and color via code.
  • By binding events (like button presses) to functions, you can create dynamic, interactive lighting experiences.

Now go make your island look less like a gym and more like a movie set. And remember: if your shadows look like they were cut with a knife, check your light’s size and shape.

References

  • https://dev.epicgames.com/documentation/en-us/uefn/UE/building-virtual-worlds/lighting-and-shadows/light-types-and-shadows/light-types-and-mobility/RectLights
  • https://dev.epicgames.com/documentation/en-us/fortnite/lighting-starter-island-template-in-unreal-editor-for-fortnite
  • https://dev.epicgames.com/documentation/en-us/uefn/lighting-starter-island-template-in-unreal-editor-for-fortnite
  • https://dev.epicgames.com/documentation/fortnite/verse-api/versedotorg/scenegraph/rect_light_component
  • https://dev.epicgames.com/documentation/en-us/uefn/UE/ue-reference-environments-and-landscapes-in-unreal-editor-for-fortnite

Verse source files

Turn this into a guided course

Add Rectangular Area Lights to your free study plan — we'll suggest related pages and stitch the lot into one compile-checked, self-guided lesson with worked examples and quizzes.

Original tutorial generated by Verse Island from the Verse/UEFN knowledge base, with references to the Epic Games sources above. Code is validated against the knowledge base.

Comments

    Sign in to vote, comment, or suggest an edit. Sign in