| Home Page | Recent Changes | Preferences

Sunlight

UT2003 :: Actor >> Light >> Sunlight

The unreal engine gives mappers a (relatively) realistic way to create sunlight. The sunlight actor simulates a distant light source originating at infinity by having it give off parallel light rays, much as the sun does. This new light actor can light a huge area (ie surfaces 32768 Unreal Units long). More sunlight actors can be placed at the same angle to cover the rest of the map.

Think of it as a regular light actor with bDirectional=True, but on steroids (and, most importantly, parallel, instead of diverging, light rays). ;)

History

Prior to UT2003, outdoor maps were dificult to light convincingly, requiring many repeated and large-radius lights (obviously the larger the map, the more lights were required). Many an outdoor map, when opened in the editor, were literally carpeted with lights. While this was a decent workaround, the main problem with this was the fact that consistent shadows could not be achieved. A dawn map would have shadows going north, south, east, west, and everything inbetween due to the multiple lightsources. Alternatively, the lighting setup could kill the shadows entirely, depending on a couple of factors.

Halflife mappers were lucky, as they have had a "sunlight" lighttype to play with for years.

Using the sunlight actor

The sunlight actor will not produce any light unless you both have a skybox and have bfakeBackdrop surfaces set. The sunlight shines 'through' the fake backdrop faces as if it was coming from outside them, in the skybox.

Mosquito: Not true, not true at all, you do not need a skybox for the sunlight to work, anything that has fakebackdrop set will emit light, you don't NEED a skybox.

See Adding Sunlight

BSP

BSP surfaces will cast shadow onto the terrain unless its fakebackdrop

Zones

Sunlight does not cross zones. You have to place a new sunlight actor in each zone.

Lens flares/coronas

There is no lens flares in UT2003. See Lens Flare for an example of code that could be adapted for a mod or mutator.

To create a corona for the 'sun' that is the source of the sunlight in your level, place a light in your skybox at the correct angle from the skyzone actor (the same angle the sunlight actor is set to), and add a corona to that light. To add the visible disc of the sun (photosphere) you will need to place some kind of fullbrighted brush or mesh right behind the light.

Tips, Tricks and Recipes

realistic sunlight settings

Simulate a sunny day effect on your dark interior map: Use a bright yellow-white sunlight actor shining in through windows and skylights for the direct sun effect, then add dim blue lights in each window to add a diffuse sky light. If your skybox shows bright terrain or sky features like big moons or sunset clouds, try adding point lights of the same color to simulate the diffuse reflected light from outside the map. It's basically a ghetto ultra-low-resolution diffuse radiosity effect.

Sunlight Problems

Real light scatters through atmospheric particles, so dawn or dusk shadows look bluish or reddish blurred. There are no light types in Unreal that create this affect.

Sunlight is usually used to light terrain. It will shadow and light BSP geometry, but there are a few glitches as of build 2166 that will need to be tweaked manually in your level. Unless your concept demands large areas of sunlight, consider using some sort of fake sunlight made from spotlights; it may work better than sunlight.

Glowing Walls

The sunlight actor can be used to simulate sunlight coming thru BSP windows into a BSP map. The effect works and is nice but can cause an unintended weird effect: many, but not all, of the corners of the BSP facing one direction may obtain a weird sunlight glow as if light was leaking under the walls. Moving the sunlight actor around or changing the angle won't help. There are no leaks; its on the lightmap.

There's several way to fix this, none of which are perfect. You will probably need to use a combination of them in different places.

1. try tweaking the lightmap resolution on the affected surface (try both higher and lower res, I had one glitch that went away when i raised it and a diff one went away when i lowered it)

2. If you can, cover the glitches with static mesh "trim" and leave'em.

3. for the rest that dont go away after #1, or arent hidden by #2, build a simple bsp shape (square or tri-prism) and place it in solid space about 16uu from the bad corner. Subtract it and move it up and down until it "shades" the glowing corner from the sunlight. Since it has no connection to the real map it will be off in its own zone and shouldnt ever really be visible to the renderer.

4. zoning/antiportal? I'm also assuming that when I start zoning this map the glitches will at least only happen in the zone with the sunlight (I hope I hope). Does sunlight shine thru zone portals like regular lights?

5. Try moving the fake backdrop faces and the sunlight angler around slightly. The glows appear dependant on the angle of the sunlight and the proximity to one of the fakebackdrop 'holes'.

You may find that the glow is small and out of the way, and can be left in.

If you are looking for perfection, you may want to fake the sunlight effect with lightboxes outside each window instead of chasing the glows around and around your map.

static mesh lighting problems

too dark:

AlphaOne: Quick question: I have two sunlights in my map (one is bright white-yellow, the other is blue to make shadows look better than black blobs) How come the sunlight actors don't light up my static meshes? I can see the shadows, but all static meshes are black as well!

ZxAnPhOrIaN: Rebuild lighting and make sure that you have a skybox! :P

AlphaOne: Actually I do have my sunlights in the sky box, and I have rebuilt it numerous times. However, I only see proper lightning on the terrain. All the static meshes are black!??? What do I do?

ZxAnPhOrIaN: Try moving the sunlights in the sb to the actual play area, that might help

AlphaOne: Thanks! It works.

ZxAnPhOrIaN: My pleasure... :P

Axe56: I've noticed that raising the zonelight properties, helps static meshes look more natural in their lighting.

too bright:

scale glow

speciallit

I'm also getting the problem where static meshes are _over_lit, but I can work around that with bSpecialLit. -Jeeptrash

disconnected shadows:

Jeeptrash Theres also a weird effect where stat meshes I sloppily left sticking into solid space are being shadowed to other places on the map. (which just means I need to redo it right) but its kinda odd to see the shadow of a mesh being cast on a wall 3 rooms away at a totally impossible angle.

Foxpaw: Is there a limit on how far sunlight can shine? I want to have light coming from a large sun in a space map I'm building, but the space area is quite large, almost the max level size. (Obviously flying into the edge of the map wouldn't be very realistic) Can I just place a sunlight actor at the edge of the world or will I need to fake it by having each ship have it's own sunlight actor that follows it around?

RDGDanClark: I haven't tested it on a really ultra-huge map, but I did build a terrain-based map with dimensions of 20480x20480 and the sunlight affected all areas just fine.


Category To Do – too much Thread mode! / Merge this page with adding sunlight

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In