Archive for December, 2013

Three Lights

Introduction

Many people who are new to the 3D graphics hobby begin by using the built-in features of tools like Poser and DAZ Studio which stop new artists from shooting themselves in the foot when it comes to lighting their scenes. Namely, the tools add one (or more) default lights to a scene so that your image doesn’t turn out a big black nothing. From there they may go on to using pre-built light sets that they get for free or that are included in some sets they buy.

But often I see artists who stop there or who express a bit of trepidation at the idea of adding their own lights to a scene. In this tutorial, I’m going to talk about how to setup a very common lighting rig that photographers use for portrait style photographs. As you might imagine, it also works well for portrait style 3D renders.

The Setup

For the scene, I decided to use Victoria 4.2 from DAZ 3D as my main character. The skin, clothing, and hair all come from Alfaseed and are available at the Runtime DNA online store. Finally the scenery is from a set called Japanese Flair. To be honest, I’m not entirely sure where I got that. I’m using DAZ Studio 4.6 for my rendering tool.

The lights I’m going to be adding are all stock spotlights. I have other lights in my content library that give me more control, but I wanted to show what you can accomplish using the built in lights first. For shadows I used raytraced shadows on all of the spotlights. I don’t care for how DAZ Studio handles deep shadow maps especially when it somes to hair; so I rarely (if ever) use them.

After I got Vicky dressed, I put her on the table in the pose I was looking for, arranged the screen in the background, and framed the shot in the camera. I didn’t want an extreme closeup of her face as I wanted to get some of the details of the Amp’d Lemonade outfit and the IIve skin as well. Then, just to see how things looked, I went ahead and hit the render button.

3 Lights - No Lights

As I mentioned earlier, DAZ Studio helps out the new artist by adding a light at render time if you haven’t explicitly added any so there is some to see. But the light is just a simple light as if it were mounted on top of the camera, not very interesting. Still, this is a good way to render a scene when you’re still working on posing and such since it renders fast as the default light doesn’t have ray tracing or shadows or anything to worry about.

Main Light

The first light I add to the scene is my main light. In this case, I want my main light to light Vicky’s face but also leave some shadows with her hair; so I’m going to put it slightly above and to the left of the camera position. When I’m placing lights, in DAZ Studio, I typically switch my view to the Perspective View, move around until I’m where I want the light to be, then insert the light, telling DS to copy my current position and orientation. The light ends up being located like this…

3 Light Layout - MainThe next thing I do is to make sure the light is pointed where I need it to. Now in a normal scene where my lights are simulating light generated by objects in the scene, I don’t always care where they are pointed. But in this case this rig is being setup to light my portrait subject; so for each light I’m going to target the portion of the subject that the light should be centered on. In the case of the Main light, I point it at Vicky’s head. The screen snips below show how I got there…

3 Light - Point At - MainFor now, I’ll leave the color set to white (255,255,255) and intensity set to full (100%) and render to see the results of adding the main light.

3 Light - Main Only

I think you can quickly see that this is more dramatic than the default “camera light” shown above. However there are clearly some issues. Like the very dark deep shadow behind her back. To alleviate that, we need to add a fill light.

Fill Light

The purpose of the fill light is to provide some light to soften the shadows opposite the main light, but still allow for there to be a contrast between the two sides of the subject. If we were to light them both evenly, the result would look flat an uninteresting. A fill light is typically at a lower angle as well since you want it to fill in some light in the shadows that your higher main light is creating. I’ll drop my fill light below and to the right of my camera like this:

3Light Layout - Fill Light

For now, I leave this light as white at 100% intensity as well. In the case of the fill light, I don’t want it to point up at Vicky’s head, I want the fill light centered lower on that black shadow behind her back; so I’ll have this light point at her hip.

3Light - Point At - Fill

To see the effect of just the fill light, I first turn off the main light and render the fill light itself.

3 Light - Fill Only

Then I turn on the main light to see what they look like together.

3 Light - Main + Fill

Looks over exposed, doesn’t it? It is. The fill light should only be about 20-30% of the strength of the main light, but we’ll address that later. For now, on to the third light in the setup.

Rim Light

The third light is called the rim or key light. This light is placed behind and often above the subject. The purpose of the rim light is to add some highlights that help outline the subject and seperate him/her from the background.

Note: In photography some interesting effects are often done by putting the rim light behind or below the subject. The problem in 3D graphics is that usually 3D hair doesn’t react with the proper translucency to achieve the glowing effect that photographers can get with their cameras.

I’ll place my rim light very high and just slightly behind Vicky like this:

3 Light Layout - Rim LightAgain I leave the color and intensity with the defaults. Then I set the point at target. I could use Vicky’s head again. But techincally what I really want to highlight with this light is her hair; so I target the fantasy drops hair instead.

3 Light - Point At - Rim

I turn off the main and fill lights to check how the rim light is looking…

3 Light - Rim Only

Just shows the highlights (as we’d expect). So I turn on the other 3 lights and render to see them all…

3 Light -Main + Fill + Rim

Well that’s … different … but way too bright time for some tweaking.

Tweaking the Lighting

First thing I need to do is adjust the intensity settings. I typically use 30% for the fill light and 90% for the rim. I could keep the rim at 100% (it isn’t adding THAT much light after all) but I don’t need that much more main lighting than what my Main was already adding. Here’s the effect of just adjusting the intensity levels.

3 Light - All Leveled

Much better! But when I’m lighting a portrait, I typically don’t like the cold harsh white lighting that comes from the default. I prefer to warm up the main light and cool off the fill and rim lights some. I played around with colors a little. Since the hair and skin have some blue and green tones I went a bit cooler on the fill and rim lights than I might normally, but the new settings worked out. I went with the following R,G,B values:

  1. Main : 255, 250, 242
  2. Fill: 240, 245, 255
  3. Rim: 245, 250, 255

The result was this image which I decided to call “good enough” (for me that means “final”):

3 Light - FinalModifications

I’ve had some people ask me before if 3 lights wasn’t too limiting. To which I say not at all! Here are a couple of examples of quick tweaks I did which change the image significantly.

Cool Blue

First by cooling off all of the lights even more, I can take a normal portait style image and make it look noctournal and/or otherwordly.

3 Light - BlueDevil in Disguise

Next I dropped the main light below Vicky. This meant I had to move my fill light closer to the camera. Doing that, I lost some details on the shoulders and hair; so I slid the rim light around so it was behind her head between her shoulders just off the end of the table. This is where those “point at” settings really paid off as I only had to move the lights without having to re-focus them on my subject!

3 Light - Angles

Lighting a subject from below gives them a more sinister look. If you watch old movies, you’ll see that effect used a lot on the villians. I changed nothing at all about Vicky. And yet her smile looks much more mischievious in this image. Also I really like how the fill light casts the shadow on the screen.

Conclusion

I hope that this gives you some understanding of how you can use a fairly simple lighting setup to create portrait style rendered images. Once you get your hands on placing and working with lights yourself I think you’ll find they aren’t nearly as daunting as you may think they are!

Is this Normal?

As an addendum to my Displaced Bumps post, I realized I didn’t mention Normal Maps.

Normal Maps

There is one primary difference (at render time) between normal maps and the bump or displacement maps I mentioned in the previous post. While the previoius two technologies ask the rendering engine to re-calculate the angle of reflection based on if a particular point was raised or lowered from the surface, normal maps actually tell the rendering engine what changes to make. They provide an offset vector (in 2 dimensions) that the rendering engine applies when calculating the light interacting with the surface.

So, while a bump/displacement map might tell the engine that the point on the mesh is raised or lowered by 0.5 centimeters, a normal map tells the engine to deflect the normal at that point by 3 degrees in one dimension and -2 degrees in the other (for example).

Is it better?

I hear all the time about how normal maps are “better” than bump or displacement. And they certainly do render more quickly. After all, they tell the rendering engine directly what changes to make to the normal angle rather than asking the engine to calculate them itself based on if the point was raised or lowered. This is why normal maps are all the rage in realtime rendering engines (like games).

However, normal maps don’t change the surface of the object. So you can’t get shadows from a normal map. You also wouldn’t see any profile changes in a closeup picture.

Also, the “proper” way to create a normal map is to use two versions of a 3D object. One is the low-res version that the map will be applied to. The other is a high-res version of the model with all of the extra details added. You can create similar maps by converting displacement or bump maps into normal maps (see my Using DS Displacement in Carrara post for more info), however the results from this sort of converted map are almost certainly not going to be all that superior to the bump or displacement map you started with. Unless your rendering engine you’re using just happens to be better at using normal maps than the others.

Displaced Bumps

Resurrecting an old tutorial I wrote for DAZ Studio about the difference between a bump map and a displacement map in 3D graphics rendering. Specific information about how DAZ Studio treats them.

Introduction

This tutorial is intended to provide a description of three types of map files (bump, displacement and transparency) that are typically used to modify surfaces on your 3D objects. It describes each of the types and uses a simple scene created in DAZ|Studio to illustrate the effects.

Map Files and Settings

Both maps are created using 256 level grayscale images. Colors are ignored in these maps, it’s the value (gray scale) not the hue (color) that makes a difference.

Poser and DAZ|Studio treat bump and displacement maps differently. In DAZ|Studio, medium gray (128, 128, 128) is considered neutral. Darker shades simulate negative changes, lighter shades represent positive changes. However in Poser, black (0,0,0) is considered neutral and all changes to the surface of the object are in the positive direction only.

This difference is important to note when trying to re-create settings in DAZ|Studio which mimic settings in Poser. Also when adapting material settings which are designed for Poser, the negative displacement setting in DAZ|Studio should be set to 0 (zero).

Version2-NoMaps

The basic scene without any maps assigned to the sphere is shown above. I’m using a plain sphere colored a dark cyan (64,128,128) with three walls each colored a dark shade of a primary color. There are three lights … a key light above and to the right of the camera, a fill light below and to the left and a rim light behind the sphere at a very high angle.

Bumping and Displacing

To understand what bump and displacement maps do, a bit of physics may be necessary. When light strikes a reflective object, the light bounces away from the object at the same angle that it struck it. So if you shoot a light at a flat surface at a 45 degree angle, the light reflecting from that surface will also be at a 45 degree angle.

( We’ll talk in another tutorial about the difference between diffuse, glossy and specular reflections, for now hang with me on this. )

When a bump map is applied to a surface, it tricks the rendering engine into thinking that the surface at that point is tilted. Darker settings indicate the surface angles down, lighter settings make it appear to angle up. It’s important to note that the surface isn’t actually changed, the bump map just fools the rendering engine into thinking it has been.

On the other hand, a displacement map does change the surface. It physically alters the geometry of the surface during rendering by raising vertices on the surface and creating a slightly different mesh.

The picture below illustrates what happens when light strikes a surface with or without one of these maps applied to it.

Light-Surface-Geometry

Bump Maps

Bump maps change the way that light interacts with the surface of an object. A bump map simulates bumps in the surface by creating highlights and shadows. However a bump map doesn’t actually change the surface of the object, it just simulates the effect. Applying the texture as a Bump Map (by placing it in the Bump Strength channel on the sphere creates the effect shown below.

Version2-Bump

For comparison sake, I also created two series of pictures showing just one quarter of the sphere.

The first series shows the same bump map applied at 50%, 100%, 150% and 200% strength (keeping the negative and positive settings at the default of -0.1 and 0.1 centimeters).

Version2-Bump-Series-Str

The second series keeps the bump map at 100%, but set the bump values at 0.1, 0.2, 0.5, and 1.0 centimeters.

Version2-Bump-Series-Val

Displacement Maps

Similar to bump maps, displacement maps change how light effects the surface of an object, however, displacement maps actually move (or displace) the surface of the object. The effect is usually stronger than a bump map with the same settings and has the added effect of changing the silhouette of the object (note the changes in the edges of the sphere and the shadow in the example image.

Displacement maps have the added value of being able to cast shadows. A bump map lightens and darkens a surface by changing the angle, but a displacement map moves it in such a way that it casts a shadow across itself and other objects in the scene.

The scene below illustrates the same texture applied as a displacement map using the default 100% +/-0.1 cm settings.

Version2-Disp

Like with the bump map, I created a two series of images. The first showing the effects of keeping the displacement values the same and adjusting the strength of the map.

Version2-Disp-Series-Str

The second series shows the effect of keeping the strength consistent (100%) and varying the positive and negative limits.

Version2-Disp-Series-Val

Choosing a Surface

So if the displacement has advantages like realistic shadows, why would you use bump maps?

There are a couple of reasons you might choose to bump a surface instead of displace it. First is that your render engine might not support displacements. Using a displacement map requires that the rendering engine is able to change the geometry of a surface during the rendering process. Poser only added support for displacement maps in version 5. Bryce still isn’t able to support displacement maps for this reason.

The second reason is that displacement is a bit harder on the processing time than bumping. Since the engine has to create new geometry as it processes your scene, displacement maps can create performance issues (albeit minor ones for most systems). However even a minor performance hit is significant in some areas (like games) so many systems prefer bump mapping over displacements.

Sometimes, both maps (using different images) may be the best way to go. For instance if I were modeling a basketball I might use a bump map to simulate the pebbly texture of the leather, but use displacement to create the indentions for the lines and logos.

Below I’ve included a side-by-side comparison of a close-up of the sphere. The one on the left uses bump mapping, the one on the right uses displacements. Both apply the map at 100% strength with -1.0 and +1.0 as their limit values.

Version2-Closeup-Compare

Summary

Applying these types of texturing maps to your models can allow you to easily create an entirely new look for an object without having to resort to modeling a new object yourself. A simple object (like a basic t-shirt or dress) can be transformed into many different looks using these techniques. This extends the usefulness of the original item and allows you, the artist, to create exactly the look and feel you want to have for the objects in your scenes.