Lighting projectors: adding depth to SL

Updated 5th December: My thanks to the venerable Ayamo Nozaki of the Exodus Team for pointing out that projectors will work with shadows enabled and set to NONE. As such, I’ve added a second example to this piece.

One of the things I’ve been most fascinated about with Second Life is the gradual development of shadow rendering. I think the first time I gave them a go was around late 2008. They were primitive them (at least on my PC of the time) and I couldn’t actually do anything with them enabled, not without my entire view stuttering around.

How times have changed.

With Exodus and Firestorm 3.2, I’m fortunate to find that not only can I run shadows and have a Viewer-side fps well into double figures, I’ve also been able to play with the wonderful new toy of lighting projectors. All I can say is, “Wow!”

Rather than burble on about things, here’s an image of a simple projector in action at my house:

“That’s me in the corner / That’s me in the spotlight…”

Brilliant, no?

You do need a fairly meaty set-up to run with shadows and projectors (and a Viewer that supports the latter) – and my Q6600 quad-core with GE9800 GT does hit some pretty high temperatures with shadows enabled…so I’d think twice about enabling the feature in a crowded dance area just for the sake of seeing pretty lights, as I have a feeling that would grind my system to a halt or have pools of molten goo running out of it as things melted… However, projectors are fun to have on when the situation suits.

I’ve also heard it mentioned that ATi cards don’t render shadows as crisply as nVidia; whether this is true or not, I’ve no idea – I mention it simply because I’ve heard several people who run hgih-end ATi cards comment on this being the case.

However, if you have a computer that’s capable of handling all of the demands of shadow rendering, and assuming you’re running a recent V3-based Viewer, here’s how to go about trying projectors for yourself.

A Suitable Texture

For the very best effects, you’ll need a custom texture – in the image above, the spotlight is a layered PNG image of a white, blurred-edge circle on a transparent base layer. However, for the purposes of testing, you can use just about any texture. In the example below I’ve deliberately chosen a high-rez image to give a slightly over-the-top demonstration of the results (remember that 512×512 textures are far more efficiently rendered in SL).

First: Enable Shadows

You need to make sure shadows are enabled on your Viewer before actually setting-up your projector. If you don’t, you won’t have access to the necessary options in the Build menu.

  • Go to PREFERENCES->GRAPHICS
  • Set QUALITY AND SPEED to ULTRA
  • Click on ADVANCED to enable all graphics options (if not already displayed)
  • Make sure BASIC SHADERS, ATMOSPHERIC SHADERS and LIGHTING AND SHADOWS (may still be referred to as DEFERRED RENDERING in some Viewers) are all checked
  • Select SUN/MOON + PROJECTORS from the SHADOWS drop-down
  • You may also want to tweak your HARDWARE options – these may not be vital steps, but they may just boost your computer’s performance a little:
    • Turn off ANISTROPIC FILTERING
    • Turn down / turn off ANTIALIASING
  • Some systems may prefer it if you disable AVATAR IMPOSTERS and AVATAR CLOTH; I found that on older V3-base viewers, I actually get a slightly higher fps with AVATAR CLOTH off when shadows are enabled (around 5 fps), but notice no real change with AVATAR IMPOSTERS disabled than with them on.

Shadows should be enabled as soon as you’ve applied / OK’d these changes. Should you encounter problems, and are running an older V2 / V3-based viewer, you might try Strawberry Singh’s video tutorial on shadow enabling.

Second: Create a Projector

I emphasise here that I’m only talking you through a very simple projector. How far you go with things is up to you.

  • Create a prim. Any prim will do – shape isn’t overly important.
  • Click on the FEATURES tab in the Build menu
    • You may have to click on MORE / v (at the bottom of the EDIT menu) to see the tabs
  • In the Features tab, there is an option called LIGHT (see below, left)
    • Note that this will only be displayed with all the options shown if you have shadows properly enabled.
    • If LIGHT only has one box next to it and three parameters (Intensity, Radius and Falloff), then you do not have shadows properly enabled on your Viewer.
  • Check the LIGHT option. You should immediately see the area around the prim passively illuminated (below, right). Nothing special here, this is normal behaviour.
So? It’s an illuminated prim…

Now comes the clever bits.

  • Click on the second box next to the LIGHT option and click on it to open your texture picker
  • Make sure APPLY NOW is disabled (in case you pick the wrong texture if you haven’t prepared one, to avoid problems undoing the selection)
  • Navigate to the texture you wish to you and click on it to preview it
  • Providing the texture is the one you want to use, check APPLY NOW. The texture is added to the prim as a projected image not as a face texture
…It projects!
  • The texture will be projected by the prim.

All that remains now is to rotate and position the prim and amaze yourself and your shadows-enabled friends. Here’s my finished example, rotated and projected against a temporary screen.

I cast a long shadow…even over Mars! 🙂

Note that you can change the colour tone for a projected texture by clicking the box closest to LIGHT to open your colour picker.

You can also modify the look of the projected image using:

  • Intensity: overall intensity of texture – range 0 to 1
  • Falloff: relative brightness – range 0 (brightest) to 2
  • FOV: size of the projected image – range 0 to 3 (largest projection) – also influenced by the projector prim’s distance from the surface(s) on which the image is being projected
  • Focus: focus of the image (hardness / softness) – range -20 to +20
  • Ambience: contrast of the image – range 0 to 1.

Using a Projector Without Casting Shadows

With thanks to Ayamo Nozaki

As noted in the comments for the article, you can also enable a projector without having shadows active. This should allow you to achieve a higher frame rate for the viewer than you might otherwise experience (when testing on Firestorm 3.2, this technique yielded an average frame rate some 8 fps higher than with shadows enabled).

To try this method, follow the steps to Enable Shadows above, but once you’ve confirmed shadows are running, set the SHADOWS drop-down in PREFERENCES-> GRAPHICS->ADVANCED to NONE.

You will still see lighting effects from any projectors around you – avatars and objects just won’t cast any shadows (see image below).

Projected image sans shadows (words by R. Crap Mariner)

This should allow you to experience any dedicated lighting systems that may be set-up, and could also be used where furniture has its own pre-set shadow textures.

Summing-up

How you use projectors is down to your imagination: using rotation scripts, you can generate “spinning” lights and other effects suitable for discos and so on; you can make the prim transparent, you can reduce it in size, you can incorporate it into other items – the list is endless.

For my part, I combined a projector with a “lamp shade” prim and a little bit of scripting so that the table lamp that forms a part of my 1-prim PrimPossible lounge suite will not only turn itself on at dusk and remain on through the “night”, it’ll also cast a pool of comforting light:

Realistic table lamp

Again, remember this is a Viewer effect – so only those who have shadows enabled on their own system will actually see the results of your labours.

Happy playing!

Advertisements