Tuesday, June 14, 2011

The Shadow Knows…

Linden Lab has been boasting for at least a year and a half that they were on the verge of bringing "best of class" graphics to Second Life and today they rather unexpectedly took a major step in that direction. As of Viewer 2.7.1, released today, Second Life residents can optionally enable a number of real-time lighting, focus, and shadow effects aimed at making the virtual world more photogenic.

Lou at home, seen through the new tricks in Viewer 2.7.1—
shadows, occlusion, and depth of field.
(Unedited screenshot direct from SL.)

One of my peeves with Second Life is that while it offered up to eight lighting sources in a particular "scene"—that's a limit imposed by OpenGL, if a video card can support them—the lighting is horribly fake. The sun and moon count as light sources, so users can encounter (or make!) up to six other light sources. Lots of people wear invisible prim "facelights" to highlight their faces—fires, video screens, lamps, vehicles, and all sorts of other things can emit light.

But it's tremendously fake light. It illuminates nearby surfaces, but it also has this amazing nuke-yoo-lar ability to penetrate solid objects: it you set a strong light on the solid roof of a building, the roof isn't going to block the light from coming inside: stand under the roof, and you will be strongly illuminated by a light that shouldn't be able to reach you. You can see this effect all the time in Second Life: lights that magically shine through walls, through stone, through avatars, through…well, everything.

Another thing that makes Second Life lighting fake is the lack of shadows. Years ago Linden Lab apparently implemented some sort of client-side "foot shadows" that can appear around the feet of avatars in the morning or evening—basically, the only time you notice them is when they're hanging in midair where they shouldn't be, because an avatar is sitting, using a pose, or something. Linden Lab apparently implemented more realistic shadowing in their official Viewer but never enabled it because it so seriously degraded the viewer's performance. Some third party viewers—most notably Kirsten's Viewer—took the idea and ran with it, but Kirsten's viewer has always been described as "bleeding edge madness"—it's for folks with high-end graphics hardware, and the few times I tried to use it, the viewer crashed on launch. (Kirsten has actually added 3D support recently, which gives me a headache just to think about.)

So. With Viewer 2.7.1, Linden Lab has finally rolled out shadows and lighting effects in its official viewer. Although the new capabilities aren't available for every graphics system that can run SL—it looks like you need something supporting OpenGL 3.0 with at least 512 MB of video RAM—users can choose to enable them and take a look. When users look in their custom graphics options (Preferences > Graphics > Advanced) there are three new checkboxes and a pop-up menu—if they're available, then Linden Lab thinks your video hardware can support it. Lighting and Shadows is the basic setting for enabling shadows—Linden Lab calls these "high quality" shadows and they seem to be sort-of right: they move dynamically with the sun and moon, respond in real time to moving objects and avatars, and deal with moving "flexi" prims just fine. They also seem to deal with alpha layers in textures pretty well: if you see a tree with swathes of leaves done using a semi-transparent texture on a prim, the shadows will enable light to shine "through" the leaves. Neat!

The performance hit seems substantial. On my admittedly-aging computer with video hardware gamers would sneer at derisively, enabling shadows essentially cuts my frame rate in half: where I would normally get 20-22 frames per second in a typical scene, I'll be around 10 or 11 with shadows enabled. (That 20-22 fps is already substantially lower than the performance I got under Viewer 1.x and SnowGlobe, so I don't really believe the Linden's claims that Viewer 2 performs so much better than Viewer 1. That might be true, but if so it's being bogged down by a bunch of other things that I probably don't particularly want it doing.)

Ambient Occulsion seems to make for more contrast in parts of objects that aren't illuminated, and produces much smoother and fuzzier shadows from the sun and moon. Depth of Field seems to be a huge performance hit, and basically, blurs out things in Second Life that you're not looking at. If you move your camera to a point, that object will shift into a sharper focus, but other things (including stuff close to you—like your avatar) will shift out of focus. The effect is similar to focus effects seen in many console and PC games, and while it feels out of place in Second Life—it makes me feel like I have a vision problem—it may have uses for screenshots and other places effects can matter. The screenshot of me at the top of this post uses Depth of Field to blur out the background—although I will note it was remarkably difficult to get my avatar into focus for that screenshot.

The Shadows popup menu hints at what I think is the most intriguing details of the new lighting system. Users can choose that no objects produce shadows (counter-intuitive, but seems to produce slicker lighting overall then turning of Lighting and Shadows altogether), have the Sun and Moon produce shadows, or have the Sun, Moon, and Projectors (emphasis mine) produce shadows. Remember that superfake nuke-yoo-lar light Second Life has had for years? That's still there, and it's called Point lighting. A Projector is a new kind of light source that can point at things like a spotlight or flashlight would—and light from Projectors produces shadows. Like, real, honest to goodness, non-nuke-yoo-lar lighting. And it can be a textured light, creating enormous possibilities for ambient effects and even simple things like projected slide shows.

Suddenly, I think the Lindens might be on to something worthwhile.

The main problem, of course, is that all this is only available in Viewer 2 (third party Viewers will eventually pick up on it) and Viewer 2 is still absolutely atrocious. I happily concede Viewer 2's script editor is slightly improved and I actually like the location bar. But. I have so many usability, interface, design, functionality, privacy, and security issues with Viewer 2 that I don't even know where to start. Suffice to say: Viewer 2 is an absolute usability disaster—and I'm not holding up Viewer 1.x as any paragon of usability, either.

Viewer 2.7.1 also includes the Linden's latest attempt to "fix" in-world search—to me, it seems sluggish, inaccurate, and near-useless, but I'm sad to report that actually is an improvement over previous versions of Viewer 2 search I've seen. Viewer 2.7.1 is also a tits-and-ass enabled Viewer, so disable that feature or be prepared to see people made of jello.

Nonetheless, it is nice to see the Lindens spring a surprise like dynamic shadows and a new type of lighting effect. (And they've even—documented it. A little.) Please continue to surprise residents with things that overcome long-time limitations of the platform. Thanks.


  1. I keep hoping someday that The Benevolent Monarchy will just admit someone made a terribly exspensive mistake with 2 code viewers.

    I didnt come to Secondlife to take pictures... yes, pictures are nice, but that isnt a make/break for most of us.
    I dont need to watch my parts jiggle.. I can stand up here at home and see that.
    Shadows are cool yes.
    How about fix group chat first....
    How about fix sim crossings...
    How about fix search...

    Darned priorities are misplaced

  2. I'm with you on that Brinda-the epic failure of group chat in particular is an Achilles Heel for my Second Life—but I also understand these aren't necessarily problems that can be solved more quickly by having more people work on them. Say it'd take 1000 man-hours to fix search, that doesn't mean if all of 200+ Linden Lab employees worked on it for a week, it would be fixed at the end of the week. More like, at the end of the week, the people who actually know how to work on search improvements would still be trying to organize the other 190+ people so they could do something useful. So I get that multiple things are underway at once, and they don't always see the light of day in an order that matches my personal sense of priorities.

    I haven't had full-text search (places, "Search All," classifieds, etc.) since October 2010. Frankly, I don't miss it.


Comments are moderated. You can use some HTML tags, such as <b>, <i>, <a>. If you'd like to contact me privately, use a blog comment and say you don't want it published.