1 Tutorials LightWave 3D Sub-Surface Light Scattering in LightWave, Using Ska Qua Jan 26, 2011 4:02 am
Admin
Admin
by Shawn Sapp |
Introduction The topic of sub-surface scattering (SSS) has received much lip service on the net of late. However, after reading anything I could get my hands on, I was still unsure about how to implement this real-world effect into my renderings. It is not my plan to teach you about the principles of SSS; this tutorial is for those that already know what I'm talking about, and want to see how it is done. There is, however, a good amount of background info on SSS at Prof. H. W. Jensen's site, and it is very well written (it was funded by the National Science Foundation). Figure 1. The Ska plugin interface I will say that SSS plays a big role in materials that we see everyday, like skin, milk, and wax, and although its effects are often subtle, it goes a long way towards removing that decidedly CG feel to a render. So lets get to it already... First of all, I'm a hobbyist in CG; my day job is as a chemist, so I can't justify buying Lightwave (LW) yet, but I'm blessed with a roommate who can. LW out of the box does not include SSS capability, so you must depend on a handy plugin. If you are interested in commercial SSS plugins go check out OGO_Hikari or Worley's G2. I want to keep things as simple as possible so I'm going to be using LW7 with the free Layout plugin Ska v1.3 that can be downloaded from web.infinito.it/utenti/k/killjoy/res/plugin.htm. The interface is shown in Figure 1 (I will cover the settings and what they do in a following section). There is only minimal documentation for this plugin, and support seems to have gone away, so I thought, "Hmm why not write a tutorial?" This plugin is very simple and effective (but also limited), but since it is free it makes a good starting point for SSS. At any rate, following this tutorial and playing with Ska on your own should tell you whether or not to pursue the more hefty commercial plugins. Figure 2. Source of inspiration showing the SSS properties of candle wax. The Scene Since wax is a translucent and scattering material, I decided to base this tutorial on the rendering of a candle. I drew my inspiration for this tutorial from a candle next to a window in my bedroom (see Figure 2). This candle sits there every day, mocking me because it is such a simple thing, yet the LW renderer cannot truly duplicate its properties. There are ways to "fake" the SSS effect, but these are time consuming so I opted for the plugin method. The scene I will be using throughout this tutorial (Figure 3) contains only one model, the candle. This model has three basic surfaces: the wick, the wax, and the melt. The melt is meant to simulate that little pool of melted liquid wax surrounding the wick. I am assuming here that you can model a candle on your own. <table align="left" border="0" cellpadding="5" cellspacing="0"> <tr> <td> Figure 3. The scene I will be using throughout this tutorial.</td> </tr> </table> The candle flame itself I will cover in detail later, so ignore the particles you see in Figure 3 for now. In most of the examples you will see, the flame was simulated with a point light (and lens flare) located close to the wick. This does not produce a convincing flame, but it does provide the lighting necessary to demonstrate SSS. I also used a dim spotlight above and to the right of the candle with shadow casting turned off. All renders were done using Low anti-aliasing (AA) with adaptive sampling set at 0.15 (this will be important later). The following section will show examples of how changing Ska's basic settings affect the rendering of this simple scene. The Plugin So where exactly does Ska come into it? The Ska plugin is applied to a surface in the surface editor as an added shader. Hold-on, maybe I should backup a little. Okay, so we have our scene and two lights, but our candle has no materials set yet. So we go into the surface editor and make this look like a real candle by adjusting the various channels as needed. Figures 4 and 5 show the surface settings that I used on the wick and melt respectively. These surfaces use only channels under the "Basic" tab. Figure 6 shows the basic surface settings for the wax, but to use the Ska plugin, settings have to be changed under the "Shader" tab. Ska is added using the drop down menu under the "Shader" tab. Double-clicking on its name brings up the interface and should look like Figure 1. That's all you have to do to implement SSS into a LW scene. You decide what objects/surfaces need SSS, add the plugin under the "Shader" tab, and adjust settings to your liking. The remainder of this tutorial will focus on the adjustment of Ska's settings and how they interact with other channels under the "Basic" surface tab. Be warned; VIPER does not show Ska's effects. In fact, I found that using VIPER was quite dangerous with Ska enabled, and I had many crashes, most of which came when I hit "F9" after adjusting settings to Ska with VIPER enabled. Hopefully my efforts will save you a lot of time and trouble when you need that little SSS boost. Now on to the settings. <table> <tr align="center" valign="middle"> <td width="33%">Figure 4. Click to Enlarge </td> <td width="33%">Figure 5. Click to Enlarge </td> <td width="33%"> Figure 6. Click to Enlarge </td></tr> </table> The settings we are presented with in the Ska interface are: Penetration, Quality, Curve, Light Boost, and settings for the color of the SSS material. Since I did not write this plugin (but [Tens de ter uma conta e sessão iniciada para poderes visualizar este link] did) I will not attempt to describe how each of these work. Instead I will show you. Figure 7 shows the rendered result of tweaking first the Quality (first row), the Penetration (second row), the Curve (third row), and finally the Light Boost (last row). The arrows indicate which setting is used for subsequent trials of the other settings. As you can see from the examples in the first row, Ska does in fact work. I don't like the noise that results from quality settings lower than 100% so I usually leave it at that. My candle model is quite low in polys, and the plugin author has suggested that you may experience less noise and fewer artifacts with higher poly models, but I have not explored this yet. Figure 7. Rendered output using Ska with various settings. In Figure 7, the first example in the first row is a rendering without Ska. The Quality settings for the rest of the row (from left to right) are: 10%, 50%, and 100%. The Penetration values are 0.05, 0.2, 0.33, 0.9, and 2.5. Curve values used were 0.1, 0.5, 1.0, 1.8, and 2.5. Boost values were 1%, 50%, 100%, 250%, and 500%. I will try to break down these settings in order with comments and suggestions for each. As I have already mentioned, I rendered these images using low AA with adaptive sampling. It turns out that if I had disabled adaptive sampling, then lower quality settings in Ska would have turned out better (as I only recently discovered). With adaptive sampling, only a quality setting of 100% would do, but with even low AA (but no adaptive sampling) I found quality settings of 15% or higher were good. This is just something you'll have to balance to your liking, but since higher quality settings lengthen render times, I find Low AA, no adaptive sampling, and 20% quality gives good results at reasonable render times. Also note that this setting only goes to 100% unlike most LW "percent" settings, which can be set to values greater than 100. The penetration setting in my candle scene appears to have only a subtle effect, but this is the "main" setting in Ska. I'm pretty sure that the units for this setting are meters, although this is by no means obvious. Thus this setting is model dependent. If your model has dimensions of a few hundred millimeters like my candle, settings of 0.1 to 2 should give you good attenuation. So if the dimensions of your model were on the order of several hundred meters, you would need settings like 100-1000 to give you good attenuation. Curve simply affects the linearity of the falloff of scattered light within the object. Think of the curve setting as being similar to changing the type of falloff on a spotlight. A value of 1.0 gives a linear falloff. Values lower than one lessen the falloff, and values above one increase the falloff. I generally did not adjust this setting (away from 1.0), but it is probably quite useful for more transparent materials. Light boost does what its name suggests; it simply boosts the SSS effect intensity. This is a useful setting to allow for a good balance between surfaces lit by LW lights and surfaces exhibiting SSS. In more complex scenes with one or more scattering surfaces and more than one light, this setting would come in quite handy. This setting can exceed the normal limit of 100%. Channel Effects and Speed <table align="right" border="0" cellpadding="5" cellspacing="0"> <tr> <td> Figure 8. Surface channels affecting the SSS from Ska. Click to see a DivX animation. </tr> </table> In playing with Ska, I became curious about adding texture to the scattered light. I experimented by adding a basic fractal noise texture to each of the channels under the basic surface setting tab. All the channels should have an effect on SSS to some degree, but I suspected that Ska only worked with some (not all) of the channels. I found that Color and Transparency had an affect on the rendering of SSS, but diffusion does not. Spec/Gloss, Reflection, and Bump are surface attributes rather than sub-surface attributes so they are irrelevant. I did not try Luminosity, but I suspect that like diffusion, it does not affect the SSS render. So the question is, does the texture created by the color and transparency channel look good enough? Well of course that depends on what you are going for. I was hoping to see an effect like a candle made with a mixture of waxes. I'll let you be the final judge. Figure 8 shows the rendering of my candle with first only a color texture, then only a transparency texture, and finally both at the same time. You should be looking at the lower part of the candle where the scattered light comes out the side of the model. See how there is a texture there now? I think it worked out quite well, however, adding even a bit of transparency adds significantly to the render times, which is true regardless of the use of Ska. Overall, I found Ska to be quite fast, especially once I discovered the trick that disabling adaptive sampling allows lower quality settings to be used. I have not used the commercial Hikari or G2 plugins, but by all accounts these are quite fast as well. Adding a HyperVoxel Flame <table align="left" border="0" cellpadding="5" cellspacing="0"> <tr> <td> Figure 9. Final Rendering. Click to see a GIF animation. </tr> </table> All my renderings thus far have used a simulated candle flame, a point light with a lens flare. This is fine for demonstration purposes, but I'd like to show some follow-through and actually finish my scene with a realistic looking candle and flame. My first approach was to use an object model in the shape of a flame. I had hoped to find a good procedural texture that could do the trick, but I quickly gave up on this approach. After reading the fine tutorial on HyperVoxel smoke generation, I decided to follow this technique using a particle emitter and a wind affector. Refer back to Figure 3, which shows the particles and the wind in my basic scene. To see my particle and wind settings click here. The HV surface and texture settings were just a slight adaptation of the settings from the HV Smoke tutorial referred to above. I left the point light in the scene (since this is the source of the SSS), but to make the animation look proper, I put an envelope on the light intensity. I added a noise channel and a particle "power" channel follower to drive the light intensity (click here to see these channels in the graph editor). This gives the candle that characteristic flicker. Figure 9 is a rendering from the final animation. Click on the image to see an animated GIF of the final animation. Conclusions <table align="left" border="0" cellpadding="5" cellspacing="0"> <tr> <td> Figure 10. Backlit Ear.</td> </tr> </table> Hopefully I have provided you with some helpful information on using Ska to produce SSS in LW. I kept my examples very simple, owing to the simple nagging of a candle in my bedroom window, but I hope you are now ready to dive into using SSS with LW. Yes, the influence of SSS can be subtle, and perhaps not illustrated well in these examples, but in this day and age in CG, the trick of fooling the human eye is often a subtle one. This is only one example of where SSS can be applied, and I hope to delve more deeply in the future. As a parting example, here is a rendering of a backlit model of an ear that I just threw together, which shows the use of the sub-surface color setting. Thank you for your attention, and good luck. - Shawn |