Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Using Shadow Maps to increase realism and depth:

Michael Bigwig
~VRML Aficionado~
Join date: 5 Dec 2005
Posts: 2,181
09-11-2007 08:54
Hello Citizens,

Below are a few screenies showcasing how influential shadow maps can be to the realism of a scene--it adds depth and weight.

Each of these examples were created in 3D Studio Max, fully mimicking its SL counterpart. Once the scene is in place in your 3d app, capture the shadow maps themselves, (for ground shadow maps, you may have to make the objects non-rendering, so you can cleanly grab the shadow map surface you need).

As a designer and 3d modeler, I feel the implementation of shadow maps and clever lighting to be of great importance to the over-all immersion and detail of a build. Very few builders and designers take into account how important these traits are.

The proof is in the pudding, as they say. Swing by my studio for examples, or IM in-world for a comprehensive explanation, and/or demo.

These examples and a few others will soon be attached to a tutorial, and placed in the Ivory Tower. Stay tuned!


*
*
_____________________
~Michael Bigwig
__________________________________________________Lead Designer, Glowbox Designs
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
09-11-2007 23:18
I've included ambient occlusion in a few personal builds. It's a bit more work and a little more texture heavy, but definitely worth it when done in moderation. Chip did this with one of his sculptie furniture pieces and the difference is fantastic. Saw another furniture designer that included a shadow layer on the floor for chairs using a partially trans prim.

After wandering the cartoon landscape, extra lighting help is certaintly noticable to these old eyes.
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
09-12-2007 07:50
When you're doing a complex interior build with well-defined artificial light sources (Lamps, etc.), this trick can make a world of difference in terms of realism. One way to apply it is to apply the shadows as an alpha-textured and partially transparent prim just above the surface the shadow is on. For simple shadow effects I sell some round and square shadow textures at various degrees of fuzzyness around the edges. Placing them under furniture has an effect similar to what you show here.

For a more advanced effect, you need to bake specific custom textures for the prim surfaces that show the shadows. I do this on some of my more advanced building projects.

If there is only one switch controlling the nearby light sources, you can even take the custom textures a step farther, and script a texture change in the surfaces, so that when the light is turned on, the shadow shows and the illuminated face is brighter, and when the light is off, the shadow is absent and the ambient brightness of the surface is reduced.

Both of these effects become somewhat moot when depicting 'natural' light sources, or as the actual sun position in SL changes. There is no rational way, for example, to simulate the changing position of a beam of sunlight coming in through an exterior window. At best, you can design the simulated lighting for a setting to depict what it should look like at a specific time in the SL day - such as lighting that only comes on at night.
_____________________
Sorry, LL won't let me tell you where I sell my textures and where I offer my services as a sim builder. Ask me in-world.
Incony Hathaway
Registered User
Join date: 18 Feb 2007
Posts: 235
09-12-2007 08:18
For fixed light sources, integrating shadows is great.. and anyone who takes the time to complete an image like that deserves a pat on the back. Its good to see folks who consider detail to be important and creating and explaining stuff like this...If SL is ever going to be more than a 3D cartoon, such detail must be integral. If anything it shows how much SL still needs to do to be realistic, if that is the direction it chooses, there is no evidence yet, that i have seen. So all power to your elbows folks.. great stuff...:)
Michael Bigwig
~VRML Aficionado~
Join date: 5 Dec 2005
Posts: 2,181
09-12-2007 08:19
I'm working on streamlining my light-simulation scripting--as mentioned, when a light switch is turned on, these aforementioned shadow maps will be activated.

As far as matching these shadow maps to the sun's position--I believe this to be possible. I've been working with a scripter on this. If you create a shadow pass for every 'change' the sun makes (via SLT), you can then tie a script to activate that particular increment of the shadow...it may seem a bit jerky when witnessed, but heck...so is the sun's movement. Just an idea...

There is a huge difference in general alpha shadowing compared to my examples above. Anyone can put a simple shadow shape under an object (we all have the shadow texture folder)--my examples are done by re-creating the scene in a 3d application, and grabbing the actual shape of the solid object's shadow...much more refined. And my example of self-shadowing is even trickier.

Thanks for the comments. :)
_____________________
~Michael Bigwig
__________________________________________________Lead Designer, Glowbox Designs
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
09-12-2007 10:09
From: Michael Bigwig
I'm working on streamlining my light-simulation scripting--as mentioned, when a light switch is turned on, these aforementioned shadow maps will be activated.

As far as matching these shadow maps to the sun's position--I believe this to be possible. I've been working with a scripter on this. If you create a shadow pass for every 'change' the sun makes (via SLT), you can then tie a script to activate that particular increment of the shadow...it may seem a bit jerky when witnessed, but heck...so is the sun's movement. Just an idea...

Great ideas.

I had considered doing sun-responsive shadows for a project, myself. It certainly can be done, but it's incredibly time consuming to set up for a large build.

If no one minds a quick story, the project I had wanted to do it for was a replica of a RL building which has a huge glass arch in the middle, running the length of the entire building. (I'm sorry the public can't see the SL version, as it's on a private estate for a very private client. I can't even name the building or the client. I can describe it though, at least a little.)

In the RL building, the arch is made up of a moderately intricate lattice of steel and glass, which has the effect of casting pretty intense shadows onto every interior surface. Practically speaking, I have to say it's a terrible design, as everyone who works in there has to wear sunglasses all day long, and they're all incredibly tan (like working under a giant magnifying glass), but visually speaking, it's really pretty cool.

Obviously, replicating those shadows in SL was a very important part of the project. It took several days to bake all the interior surfaces just for one sun position. It would have taken many months to do them all, so I had to abandon the idea. I just locked the sun and left it at that.

So, I'm especially interested to see whatever you've got in mind, Michael, since I never got to do my own. As I'm sure you realize, I'd suggest doing something small as a proof of concept, maybe an outdoor gazebo or something. A 2-sim-sized glass building is probably not the best place to start. :D


From: Michael Bigwig
There is a huge difference in general alpha shadowing compared to my examples above. Anyone can put a simple shadow shape under an object (we all have the shadow texture folder)

Agreed. It's interesting though that 99% of builders don't even do that much. It's one of those 2-second things that seems to separate the big fish from the little guys. I'm really not sure why more people don't do it.

From: Michael Bigwig
my examples are done by re-creating the scene in a 3d application, and grabbing the actual shape of the solid object's shadow...much more refined. And my example of self-shadowing is even trickier.

Yeah, it takes access to, and knowledge of how to use, a good 3D modeling program and a good renderer to do this kind of work. Not everyone in SL is gonna be able to do it (unfortunately), at least not without being willing to invest the time it takes to learn how. It's a lot less intuitive for most people than just painting shadows in Photoshop (we all painted in Kindergarten, but how many of us lit scenes and played with database nodes to create shaders?). The results can be stunning though, and once you know what you're doing, it can be a lot faster than working in 2D, so it's well worth the learning curve for anyone who's serious.

I'm looking forward to seeing your tutorial, Michael. Hopefully it will help a lot of people.



By the way, if anyone's interested, for Maya users running on Windows, I can't speak highly enough of the Turtle renderer for this sort of thing. A friend of mine turned me on to it about 6 months ago, and I continue to be amazed by it. If you're used to stock renderers like Mental Ray, you'll be blown away by how much time Turtle saves you and how good its results look. To my knowledge, it's the only renderer in the world streamlined specifically for baking for real-time environments like SL. It's relatively simple to use, with everything you need all in one place, and it's incredibly powerful. Check it out at www.illuminatelabs.com.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
09-12-2007 11:54
From: Chosen Few


Quote:
Originally Posted by Michael Bigwig
There is a huge difference in general alpha shadowing compared to my examples above. Anyone can put a simple shadow shape under an object (we all have the shadow texture folder)

Agreed. It's interesting though that 99% of builders don't even do that much. It's one of those 2-second things that seems to separate the big fish from the little guys. I'm really not sure why more people don't do it.


It's a big assumption that everyone has these shadow textures. I've been searching in world for some since someone brought it up on Second Citizen last week, and so far I've come up empty. I don't suppose anyone would be kind enough to tell me where I can get some of these shadow textures?
_____________________
Michael Bigwig
~VRML Aficionado~
Join date: 5 Dec 2005
Posts: 2,181
09-12-2007 12:12
Chosen,

Yes, creating shadow passes that script to the changing sun would be counter-productive on a big sim--especially if they had a deadline set. The project I was going to recreate was a cool looking sundial. I could create it in Max and SL identically, then in Max I would only need to render about 12 different lighting setups (for the initial test). I would also have to make sure that as the sun rose and set, the intensity of the shadow increased and decreased.

Also, addressed to both Chosen and Darien,

I wasn't assuming that all citizens had a shadow map folder--what I should have said was those that DO implement shadows in their work, probably have a stock set of shapes and dithers (IM me inworld, and I'll pass the folder to you, as it was passed to me young Padawan).

And yes, I too find it odd that SO many people don't use a single shadow in their stores, studios, offices, clubs, etc. It makes a huge difference in immersion, and in my eyes is the mark of a designer who can see the forest through the trees. If you were to swing by my studio, you'd notice that nearly everything casts a shadow. I understand that some people are much more concerned about their prim budget--but let me assure you, it is better to be a touch more minimal in your layout, and allow a few dozen prims to be accounted for by shadow maps.

Even though I am capable of baking textures...I've yet to go there, but soon I shall. In my eyes you really only have to bake textures if a shadow crosses over an organic shape, or you want to create a sculptie. The method of self-shadowing I use doesn't require baking.

Cheers! Happy shadowing.
_____________________
~Michael Bigwig
__________________________________________________Lead Designer, Glowbox Designs
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
09-12-2007 12:14
Actually, I have no idea what folder Michael was talking about. I was mainly talking about the fact that anyone can make a generic shadow texture in a matter of seconds, and apply it anywhere.

There have been numerous posts on this forum about how to do it, but I'll put the basic instructions again right as well:

1. Paint your canvas black.

2. Put the shape of your shadow in white on an otherwise black alpha channel.

3. Give the alpha channel a generous Gaussian blur to soften the edges of the shadow's shape. Diffused shadows tend to look more believable in SL than sharp ones for general use. Juat make sure the blurring doesn't reach the edges of the canvas or you'll see a hard edge when the shadow is in SL.

4. Save as 32-bit TGA and upload to SL.

5. Apply the shadow to one side of a cube. Apply a completely transparent texture to the other six sides.

There you go. The whole process should take about 30 seconds at most.

To adjust the apparent intensity of the shadow, adjust the prim's transparency setting in SL. THe more transparent you make the prim, the lighter the shadow will appear. The less transparent, the darker the shadow.

I suggest at a minimum making a rectangular shadow and a circular one. Those two shapes will cover about 50% of all the shadows you'll ever need. Make additional shapes as the need arises.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Michael Bigwig
~VRML Aficionado~
Join date: 5 Dec 2005
Posts: 2,181
09-12-2007 12:24
Nice to know how it's constructed (in case you want a unique shape)--however, for general objects (chairs, beds, hanging pictures, tables, etc) you only need the end-all-be-all 'Shadow Folder.'

There are over a dozen different unique shadow shapes (each with hard dither or soft).

Do you know what I used to do? This is kinda funny...I used to layout my furniture (or what have you), then I used to take a top-down screen-grab of the entire room. I then opened this in Photoshop. Using the screen-grab as a template, I then began painting the shadows of every unique object. So actually, you have one large prim with several different shadows painted on it...it works pretty well actually. However, most of the time the definitive shape of a shadow isn't needed. Anyway...just an idea for those that care to give it a go.
_____________________
~Michael Bigwig
__________________________________________________Lead Designer, Glowbox Designs
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
09-12-2007 13:15
Thanks for the info, Michael and Chosen. :)

I think if more people were graphics wizards, you would see more builds with shadows. Having said that, I'll give it a try for an upcoming build I'm doing. Thanks again.

P.S. Check out Lion Ewry's stuff on SLExchange. Trees with shadows that follow the sun. Pretty impressive, and the shadows can be used with other trees.
_____________________