Skip to main content

Blog Archive

Lights On: Dynamic Lighting and Shadows are Here

May 09, 2013

by zeuxcg


Archive

No more previews, contests, or prototype videos. Today, we officially flipped the switch on dynamic lighting–and we can’t wait to see what our builders do with it. Dynamic lighting is a smart voxel solution that not only lets builders control the ambient light and resulting shadows in the worlds they create, but place customizable light sources for aesthetic and gameplay purposes. Torches, flashlights, lamps–the future is a bright one. 

We’ve covered the development and testing of this massive undertaking in several blog articles, so with the actual release we decided to walk you through the impact of dynamic lighting, and the new, dynamically lit ROBLOX. To do this, we tapped Client Engineer Arseny Kapoulkine, who was a pivotal cog in this project, and asked him, “what now?” He explains:

Welcome to the new, dynamically lit ROBLOX. We imagine, based on the curious and excited feedback we’ve received on the forums and on the blog, that you’ve got some questions. With this article, I’ll walk you through the basics of implementing lights in a new or existing place or game. Before we get into that, allow me to officially answer two of the most-asked questions about dynamic lighting.

Now that the lights are on, are my indoor places going to go dark?

With this release, none of your existing places or creations on ROBLOX will change at all, unless you choose to change them (which we encourage you to do). To enable lighting in one of your current places, open the place in ROBLOX Studio, and click on “Lighting” in the explorer pane. Check the “Global Shadows” box to gain access to new variables that we’ll discuss later in the article.

Soon, any new place that you create in ROBLOX will have realistic shadows enabled by default. For now, these settings only auto-apply when you create a new project within Studio (as opposed to the “Build New” button on Roblox.com’s Build page). We’re working on a fix for this now.

Will my computer be able to handle dynamic lighting?

One of the most important aspects of developing ROBLOX’s dynamic lighting system was scaling it to all the hardware we currently support. 95% of computers should be able to handle the inclusion of lights with no problem whatsoever. Though dynamic lighting is supported across platform (Mac & PC), we’re currently working on our implementation of OpenGL ES, which will allow us to enable dynamic lighting on ROBLOX Mobile without a serious performance drop.

Now that we’ve got that out of the way, let’s talk about experimenting with dynamic lighting.

Turning the Lights Off

This is actually a good place to start, as a completely dark place drastically changes once you start adding lights. There are two components to dynamic lighting: lighting, and shadows. Before we get to lights, let’s talk about how shadows will be different, and how to completely darken your virtual world.

Shadows are controlled by three parameters in our new lighting service (as opposed to just the sun). There has always been an object in your Explorer window called “Lighting”–this object now has two new properties. Before we get to those, make sure the “Global Shadows” box is checked to enable both properties.

Whereas before, “Ambient” settings let you choose the darkest color you can see in your virtual world, there’s now another component called “Outdoor Ambient.” Setting the color in “Outdoor Ambient” will choose the darkest color you can see outside, while setting the “Ambient” color will set the darkest colors you can see inside.

By default, “Ambient” is set to black in any new place you create. This means that the insides of caves and indoor structures will be black. The “Outdoor Ambient” parameter will be middle-gray by default. These default settings will provide you with the most realistic shading system upfront, though they can be tweaked to any color you’d like. Here’s a before-and-after look at one of our test places. Default settings are on the left, and on the right we’ve made the “Outdoor Ambient” color bright red.

Pretty dramatic difference, right?

There are a few additional steps you’ll need to take to fully darken your world. First, set the brightness of the sun to zero (as opposed to switching to night time–the moon still emits light, just not as much). Second, set “Ambient” and “Outdoor Ambient” colors to black.

Keep in mind, you don’t have to completely darken your world to leverage dynamic lighting.  Doing so will simply show you the most dramatic environmental effect. Regardless of the light coming from the sky–be it from the sun or the moon–you can still integrate dynamic lights, as described in the next section.

Turning New Lights On

We’ve provided you with two different types of lights to experiment with: point lights, which emit from one specific point in the shape of a sphere, and spotlights that take the shape of a cone. Both of these lights are now objects that you can place in Studio. To find them, click Insert > Basic Objects and find either the SpotLight or PointLight objects. Each light must be parented to a part in order to work. Similar to our fire, smoke, and particle systems in general, dynamic light takes its position from the part that parents it. A great first experiment would be to take a model of a lamp (or a car, or anything that emits light really), insert the model into your world, then insert the lighting object into the model.

If you want to add lights with no objects or parts whatsoever, make the part invisible. You’ll have full control of the color, brightness and range of the lights. Point lights, for example, allow you to control the maximum distance of influence from a single light. Spotlights not only allow you to control the range of the light, but also the angle of the cone.

Looking Ahead

As with any new feature, we’ll be working to enhance our dynamic lighting system as we go along. We were awestruck by the amount of creativity and invention we received when we asked our users to create videos showing off dynamic lighting. We were equally blown away by the amount of feedback we received from our builders–you deserve credit for helping to shape the foundation of our new look.

Looking ahead, we want our dynamic lighting system to be able to create realistic shadows based on the angle and size of the lights, on any part imaginable. This is a huge undertaking that we’re currently developing. As mentioned before, we’re also working on porting this system to ROBLOX Mobile, and estimate (but don’t promise!) that we’ll have that out mid to late June. For now, builders should share feedback in the I Made That Forum. If you want to talk game design around dynamic lighting, check out the Game Design Forum. If you want to talk about specific building techniques and see how others are leveraging dynamic lighting, check out the ROBLOX Studio Forum. Lastly, keep an eye out for this week’s gear, which will have a dynamic lighting theme.