Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 51 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
51
Dung lượng
3,84 MB
Nội dung
BRDF (Bidirectional Reflectance Distribution Function) Yes, this shader has one of the most impressive names in the whole 3D field! Amaze your friends by dropping this term at important events, and then pretending that it is something really profound. Further amaze them with this really complex explanation: The bidirectional reflectance distribution function gives the reflectance of a target as a function of illumination geometry and viewing geometry. The BRDF depends on wavelength and is determined by the structural and optical properties of the surface, such as shadow-casting, multiple scatter - ing, mutual shadowing, transmission, reflection, absorption and emission by surface elements, facet orientation distribution, and facet density. Just make sure that you look like you know what you are talking about when you say all that. In terms of actual execu- tion, the BRDF shader is actually quite simple. And the cool thing about this shader is that it can be used for a couple of different things. Take a look at the shader’s interface in Figure 5-42. It looks a little complex, doesn’t it? First, and most simply, you can use this shader to exclude certain lights within the scene from the surface. Notice the list on the left-hand side of the panel where all the lights in the scene are listed. You can check or uncheck each light in this list, depending on whether you want it to affect the surface or not. Just click on the little checkmark next to the light’s name to disable it. Selecting each light in the list also allows you to set values for the light’s strength on the surface. You can enter this value in the field labeled Light Strength. That is the first useful thing about this shader, although it is not the actual main intention of it. It is just one of those little things that you can use it for. The main purpose of this shader lies in its ability to assign up to three different layers of specularity, each with different settings, onto the surface. Chapter 5 ······································· Part 2 86 Figure 5-42 Figure 5-43 Figure 5-44 Why would we need to do this? Simple. Some surfaces have multiple layers of specularity, or at least appear to. Take a look at any lacquered sur - face, such as wood that has been varnished. How would you texture that? Sure, we could take a quick route and just make it nice and shiny, and a bit glossy as well. However, a more realistic approach would be to consider the properties of the wood and the properties of the varnish separately. Because surely, when you think about it in those terms, you realize that wood has a different specularity than varnish. In this case, you can use this shader to specify that the surface has a layer of low specularity (the wood), which is covered by a second layer that has a higher specularity (the varnish). Take a look at Figure 5-45. In this image, the first sphere shows the wood texture using just a normal low specular setting, as would be appropriate for wood. The second sphere shows a higher specularity and gloss set- ting, more suitable for varnish. The third sphere uses the BRDF shader to create two separate lay- ers of specularity, each with specular and gloss settings appropriate for its substance. Figure 5-46 shows the first layer of specularity. This is a broad highlight for the wood. I have used a color for the highlight here as well, as wood tends to have a lot of its own color in its specularity. Figure 5-47 shows the settings for the second layer in the BRDF shader, the layer that gives the specular look to the varnish on the wood. As you can see, this has higher specular and gloss settings and is set to pure white so that it is nice and shiny. In the render that we saw previously, this creates a nice glossy highlight on top of the broader, duller highlight, just as varnish on wood would do. ·························· Advanced Options in the Surface Editor The Surface Editor 87 Figure 5-45 Figure 5-46 Figure 5-47 This example uses only two layers of specularity, but the shader does allow up to three layers that you can stack on your surface. All these examples have used the Regular option of the Specular Reflection setting. Now onto the other types. The third use for this shader is for applying anisotropic shading to your surface’s specularity. Anisotropic shading is useful for when you are creating surfaces such as brushed metal, where the surface is covered by tiny grooves that break up the light, consequently causing a distortion in the reflections and highlights on the surface. The BRDF shader offers two types of aniso - tropy: Anisotropic (controlled by two angles of disturbance) and Anisotropic II (which uses map - ping coordinates to control the disturbance). Anisotropy is defined with two values, Aniso - tropy and Direction, both of which are measured in degrees. The Anisotropy value sets the angle along which the “grooves” in the surface lie, while the Direction value determines the angle at which light will gather in these grooves. Figure 5-49 shows a sphere with an Anisotropy set- ting of 0° and a Direction value of 90°. As you can see, this causes the light to gather perpendicular to the direc- tion of the Anisotropy. This setting would be ideal for a brushed metal sur- face such as typically found on lava lamp bases or stainless steel kitchenware. Figure 5-50 shows the same sphere with the settings switched around, so the Anisotropy value is now 90° and the Direction value is 0°. As you can see, the results are rather different. This type of setting almost emulates a radial anisotropy such as you find on the knobs of a hi-fi system. The Anisotropic II option allows you to use either Cylindrical, Cubic, or UV parameters to define the anisotropy. The Cylindrical and Cubic mapping types are shown in Figure 5-51. The Cylindrical option allows you to select an axis along which the anisotropic effect will project. The UV option allows you to use a selected UV Chapter 5 ······································· Part 2 88 Figure 5-48 Figure 5-49 Figure 5-50 Figure 5-51 map as the method of defining the anisotropic effect. The way that this option works is that it looks at the way in which your UV map is constructed and determines the direction for the effect. You alter the effect and create patterns by flipping the points within your UV map in Modeler, using the Flip UV Point Map command, or by manually rotating parts of the map around. Figure 5-52 demonstrates this. The cube has been UV mapped and every other block in the UV map has been rotated. As you can see, this forms a checkerboard type pattern where the light hits the surface, even though there is no such texture applied to the model. This is because the anisotropic effect is now defined by the coordinates of the UV map, and since some of those points have been flipped, the effect becomes flipped. You may wonder how this could be useful. Well, you could use this to create iridescence in surfaces, or simply to create other unusual patterns of light. Edge Transparency This particular shader is only for use with surfaces that are already transparent to some degree, as its purpose is to define the clarity of transparent edges. This is espe- cially useful for clear transparent surfaces that often tend to lose clarity when placed in front of other objects or a backdrop. Take a look at Figure 5-54. The logo on the left is a simple transparent surface, while the logo on the right uses the Edge Transparency shader (with default settings). As you can see, the shader creates edges that appear solid to a certain degree, using the surface’s color. The shader gives you three different types of blending for the edges: Opaque (the default), Nor - mal, and Transparent. The Opaque option (shown in the previous fig - ure) creates an adjustable black semisolid-looking edge, while Normal subtly creates the appearance of a totally solid, hard edge. Transparent makes the edges blend completely away with no definition whatsoever. Both the Opaque and Transparent options have a Edge Threshold setting that you can ·························· Advanced Options in the Surface Editor The Surface Editor 89 Figure 5-52 Figure 5-53 Figure 5-54 adjust to vary the amount of blending between the surface’s color and the transparency at the edges. Figure 5-55 shows each of the types using default settings. Use Edge Threshold to soften or harden the edges by increasing or decreasing the value, respectively. The following image shows a low value and a high value of Edge Threshold using the Transparent type. Surface Baker The Surface Baker shader is an extremely useful little thing. Have you ever created a really cool procedural texture in LightWave but wished you could somehow manually paint some more details into it? Or have you ever wanted to somehow add the high - lights and shadows from your scene lighting into your textures for a game model? This is what the Surface Baker shader is for. You essentially bake your tex - tures and/or lighting information (this includes all highlights and shadows, and even caustics and radiosity) to an image (using a UV map) or directly onto your object’s vertices. Chapter 5 ······································· Part 2 90 Figure 5-55 Figure 5-56 Figure 5-57 To use the Surface Baker, simply assign it to your surface, set it up as desired, and render your image. The image baking will occur before the camera rendering takes place. Once the baking is done, the image is saved to a selected destination, and the rendering of the actual scene (through the camera) follows. Let’s have a look at all the options this shader gives us. At the top of the shader’s panel we have the Bake Entire Object option. Checking this option will bake all the surfaces of that entire object instead of only the surface to which it is applied. This is particularly useful when baking the effect directly to a vertex map assigned the entire model (using the Bake To Object option, dis - cussed next), since it saves time. Next, we have the Bake To option, which gives us two choices from a drop-down list: Image and Object. Baking to Object bakes all the texture information to a vertex color map that you enter or select from the VMap Name field. Checking the Continuous Map option above the VMap Name field turns on polygon smooth- ing so that the map is smoothly interpolated between vertices (basically it is the same as the Smoothing option found in the Surface Editor, discussed in Chapter 3). Deselecting the option will result in sharp changes at the vertices, which is the effect you would probably want if you were baking the textures of objects like walls or a sharply edged object that you wouldn’t want to have smoothing applied to. Once you have created the baked vertex map you can apply it to the surface by going to the Advanced panel in the Surface Editor and selecting it from the Vertex Color Map drop-down list. Baking to the Image option lets you choose a UV map (previously created in Modeler) to which the textures will be baked. When baking to an image, you have options to select which UV map you wish to bake to, what image resolution you want the baked texture to be, and what type of image (for - mat) you’d like LightWave to save the image as. ·························· Advanced Options in the Surface Editor The Surface Editor 91 Figure 5-58 Figure 5-59 Figure 5-60 Figure 5-61 Figure 5-62 NOTE: When saving the resulting baked image as a 32-bit texture, please take note that the wireframe of the UV map is included in the alpha channel of the image. Many people get a bit confused when they apply the baked image as a texture to their model, only to find upon rendering that the image looks really bizarre. If you find this happening, simply open the Image Editor and disable the alpha channel. Select the UV map from the UV Map drop-down, which lists all UV maps that are currently created for that model. Enter an appropriate image resolu - tion for the baked image. This determines the actual pixel dimensions (width and height) of the image. Remember that larger images are better quality, especially for close-up shots. Choose the format you wish to save the image as from the Image Type list, and enter a name for that image in the Image Base Name field. Clicking on the Image Base Name button allows you to browse for a destination to which LightWave saves the image upon rendering. When baking textures, you have four basic options for what you actually want to bake into the baked image or vertex color map: Color, Diffuse, Illu- mination, and Shaders. You can select any or all of these options when setting up the shader. Selecting Bake Color bakes all textures assigned to the Color Texture Editor in the Surface Editor. Figure 5-64 shows a painted texture combined with some procedural textures that have now been baked into a single image. The Bake Color option includes any images or procedural textures, as well as any gradients except view-based Incidence Angle (cam - era angle) gradients. This is because it is pointless to bake details that are dependent on view - ing angles into a flat image. You can, however, bake Light Incidence gra - dients into an image. The Bake Diffuse option bakes any diffuse shading (textures applied to the Diffuse channel) from the surface into the image. Selecting this option alone creates a plain texture, but when baking this together with the Bake Color option you’ll notice a considerable difference. Chapter 5 ······································· Part 2 92 Figure 5-63 Figure 5-64 Figure 5-65 shows the color textures from the previous example now combined with Bake Diffuse. A procedural texture that was assigned to the surface’s Diffuse channel is now included in the image. Notice that the image is now somewhat darker from the inclusion of the diffuse shading. Bake Illumination bakes all lighting and shadows from the scene into the textures. This option is great for situations like game envi - ronments, where you can simulate all the lighting effects into your tex - tures without having to use real-time lighting in the game engine for this purpose. This option will include all kinds of shadows, radiosity, and caustics from the scene in the image. Only use this option if you want shadows and highlights in your textures. Ordinarily, we wouldn’t use this option for visual effects or animation, as it will create lighting discrepancies, especially if the character or object starts moving around. Figure 5-66 shows the same textures from before with the light- ing from the scene included by using the Bake Illumination option. Lastly we have the Bake Shaders option. As its name sug - gests, this option simply includes any applicable information from shaders assigned to the surface into the baked image. Of course, once again, incidence-based shaders like the Fresnel shaders cannot be baked since their effect is dependent on viewing angles that makes them useless in a flat image. At the bottom of the Surface Baker panel we find two options for refining the quality of the baked image — AntiAliasing and Shading Noise Reduction — as well as the View Image option. ·························· Advanced Options in the Surface Editor The Surface Editor 93 Figure 5-65 Figure 5-66 Figure 5-67 AntiAliasing smoothes the image (exactly like using antialiasing on your camera when rendering). While it does add to your rendering time, it pro - duces a much better quality image. Shading Noise Reduction applies a low-level blur to the final image to reduce any grain that might appear within the image. This is particularly applicable when baking illumination, especially radiosity. It is exactly the same as the setting of the same name found in your Global Illumination panel in Layout. Check the View Image option to have the image open in the Image Viewer once it has been rendered. Fast Fresnel and Real Fresnel The Fresnel effect is discussed a number of times in this book, but to save you the hassle of paging through all the chapters trying to find an explana - tion, I’ll repeat it here once again. Named after the French physicist Augustin Jean Fresnel, the Fresnel effect is the phenomenon that we observe in the real world whereby the amount of reflection that we see on a surface differs according to the angle at which it is viewed. Look at the sea as an example. When we are standing in the ocean look- ing straight down into it, we can see all the way to the bottom. However, as we move away from the sea, and view it from a distance, it appears to be very reflective, as the angle that you are looking at it has decreased. When the sea is on the horizon, far away in the distance, it appears to be almost mirror-like, so that if you never saw it close-up, you would never think that the water was actually almost completely transparent. A common example of this effect can be observed in any glass object. Take a look at a glass, and you will notice that the edges of the object appear far more transparent as they slope away from your direct angle of vision. We have two shaders in LightWave to cre - ate this effect. Let’s look at Fast Fresnel first. Figure 5-68 shows the Fast Fresnel shader’s control panel. While the Fresnel effect in reality is con - cerned with reflections and refractions of light, we can use the Fast Fresnel shader to apply incidence-based effects to any of the surface properties listed, namely Reflectivity, Luminos - ity, Diffuse, Specular, Transparency, and Translucency. Above the properties we have a field labeled Minimum Glancing Angle. This value determines the beginning value from which the effect will be measured. Generally this value would be 0° since that is the angle at which we Chapter 5 ······································· Part 2 94 Figure 5-68 view a surface straight on, and having the effect measured from 0° also gives us the widest spread of the effect (which is mea - sured up to a maximum of 90°). The maximum value for this effect is 89° (since this is the area of the surface that slopes out of our vision), so entering a value of 90° in this field would nullify the effect. Next to each of the surface parameters are fields where you can enter values between 0% and 100%. This basically con - trols the intensity of the effect for that particular surface property when it reaches the higher glancing angles (90°). For example, if we leave the reflectivity value at 100% (default), then the reflectivity of the surface will increase from whatever value is assigned to the Reflection channel (in the Surface Editor) to a maximum of 100% at the edges of the surface where it slopes away from our vision. So basically this value determines the strength of the effect in that channel on the edges of the surface. While this particular shader has no option for affecting the Glossiness, Color, or Refraction channels, we can fake the effect using gradients. This is discussed in depth in Chapter 9. NOTE: It is worth mentioning that when using the Fast Fresnel shader, LightWave’s renderer treats your surface as a transparent sur - face, even if there is no degree of transparency applied to it. This means that the surface takes slightly longer to render than usual. Moving on to the Real Fresnel shader, we find a much simpler-looking shader inter - face, as shown in Figure 5-71. This shader has fewer settings because it is based on realistic physics, as opposed to the Fast Fresnel shader that is basically a quick-and-dirty Fresnel solution. This shader automatically makes your surface transparent when you add it to the shader list and calculates the transparency falloff using the Fresnel algorithm. The Reflective Polarization and Specular Polarization settings deter - mine the values for those two particular surface attributes when the camera is perpendicular to the surface (90°). This means that the higher these ·························· Advanced Options in the Surface Editor The Surface Editor 95 Figure 5-69 Figure 5-70 Figure 5-71 [...]... choose from Add, Multiply, and Blend The Add and Multiply options are much the same as Figure 5 -82 the blending modes of the same names we find in the Texture Editor (discussed in depth in Chapter 13) Using the Add option, the RGB values of the Figure 5 - 83 colors are literally added to the underlying colors 98 · · · · · · · · · · · · · · · · · · · · · · · · · · Advanced Options in the Surface Editor The... sums up LightWave s native shaders Figure 5-1 03 106 · · · · · · · · · · · · · · · · · · · · · · · · · · Advanced Options in the Surface Editor The Surface Editor Third-Party Shaders There are a number of commercial and free third-party shaders available for LightWave as well Many of the free ones are developed by prominent members of the LightWave community, and can be found by looking through LightWave. .. the progressive Max and Min values of each zone softens the transition between each zone slightly Figure 5 -88 shows the difference between keeping a 10% difference between zones (the logo on the left), as opposed to having no difference from the Max of one zone to the Min of the next 100 Figure 5 -88 · · · · · · · · · · · · · · · · · · · · · · · · · · Advanced Options in the Surface Editor The Surface... and Texturing We now know what shaders in LightWave are, and we have had a good look at each of the surface attributes that we deal with when creating surfaces, but before we delve into the world of creating textures, I thought it important to add a note about the differences between shading and texturing Put simply, the art of creating surfaces involves three distinct stages: mapping, shading, and texturing. .. surface parameters, G2 allows you to boost a few things that you ordinarily cannot adjust within LightWave 1 08 · · · · · · · · · · · · · · · · · · · · · · · · · · Advanced Options in the Surface Editor The Surface Editor The first of these, Global Illumination, allows you to brighten or darken the effects that LightWave s global illumination (radiosity and caustics) within the scene have on this particular... Figure 5-1 23 This is actually quite simple For example, let’s say you are shading a face and you have assigned a value of 32 % Specularity to the surface Of course as we know, skin has a lot of variation in its specularity, so ideally we’d paint a texture for this particular surface attribute so that we can add in variations and details where we want them We know that overall we want a value of 32 % Specularity... it (the visible edges) As the Limit value increases, the effect “creeps” inward from the edges of the surface, as shown in Figure 5- 93 The Strength value determines how strong the effect is at the edges Higher values have the effect encroaching a lot more on Figure 5- 93 the edges This value can go higher than 100%, but doing so tends to make the surface look less 2D (See Figure 5-94.) 102 · · · · ·... just like a cartoon Cel is the term given to the individual frames of hand-drawn animation Television shows like Futurama use cel shading to great effect for integrating parts that are actually done in 3D into the 2D animation of the show itself This particular shader simply alters the renderer’s shading algorithm so that the surface no longer has smooth transitions between colors, turning them instead... LightWave community, and can be found by looking through LightWave community sites like Flay.com or NewTek’s forums Some of the most popular commercial shaders are developed by Worley Labs and Evasion |3D, and can be investigated and ordered from their web sites Worley Labs’ G2 While there are too many third-party shaders to mention all of them here, I thought it worth having a look at one of the most... shading and lighting system is much more than just a shader for your surfaces, but since this book is a texturing book, we’ll only be looking at its surfacing functions However, it is definitely worth mentioning that the plug-in includes a number of advanced lighting features and a previewing system that puts LightWave s Viper to shame! Be sure to check out Worley’s site at www.worley.com for more information . in Chapter 13) . Using the Add option, the RGB values of the colors are literally added to the underlying colors. Chapter 5 ······································· Part 2 98 Figure 5 -80 Figure 5 -81 Figure. of the next. Chapter 5 ······································· Part 2 100 Figure 5 -86 Figure 5 -87 Figure 5 -88 As you can see, the difference between the two is quite slight but still noticeable. colors. Chapter 5 ······································· Part 2 98 Figure 5 -80 Figure 5 -81 Figure 5 -82 Figure 5 - 83 The Multiply option multiplies the RGB values by a value from 1 to 0, depending on what