Select the desktop object and move to the Material buttons F5, selecting the Mirror Transp panel.!. With the desktop object selected press F6 to change to the Texture buttons... Select t
Trang 1As a result, it is much easier to achieve a reflection using Raytrace, so that is the method you will use here
Note: Indiscriminate use of raytracing for reflections and transparency can still drastically raise your render times For rendering still images, this is not usually a big deal For animation work, where you might be rendering thousands of frames, those extra minutes can add up If you will be using reflection in your animation work, you are urged to investigate the Env Map method
Reflective Materials Need Something to Reflect
Currently your scene has nothing to reflect, as only the desktop has been modeled However, you don't need to model an entire office around your desktop You can simulate the reflected color from the office walls by changing the world color to approximate the real environment
! Select the World button (F8) and change the Horizon color
Figure MTT.24: The World panel from the World buttons
! Set the HoR to 0.540, HoG to 0.427, and HoB to 0.275
! Press ENTER to confirm those settings
Trang 2Adding the Power Supply for Some Close-Up Reflection
Apart from the walls and the world around the desktop, there is a power supply on the desk as well If you look closely at the reference photo at what appears to be shadow below the supply and its cable, you will see that it is in fact a reflection on the desk surface and not really a
shadow
If you are building your own power supply and cables for modeling practice, now would be a good time to do so If, however, you are using the included sample blend file, then Shift-LMB on the Layer 2 button on the 3D header to show the pre-made models
Figure MTT.24.1: The objects on Layer 2 are now showing
Set Raytrace Reflections for the Material
! Select the desktop object and move to the Material buttons (F5), selecting the Mirror Transp panel
Trang 3This tab may appear complex, dealing with things like Fresnel, Falloff, and IOR, but for uses where you only need simple reflection, there are only 2 settings and one button that need concern you
Figure MTT.25: Mirror Transp tab with raytrace reflection settings highlighted
Ray Mir is the amount of raytraced reflections and varies between 0 and 1, with 0 reflecting 0%
of light from the surroundings and 1 reflecting 100% of it
! Set it to 0.49
Depth refers the depths of calculation that Blender makes to trace the ray For example, a ray that must bounce off two different mirrors before hitting its light source would require two levels of calculations The default is 2 but its range is from 0 (no raytrace reflections) to 10 (significantly longer but more accurate raytracing renders)
! Make sure it is set to 2
! To enable the Ray Mirror material effect, turn on the Ray Mirror button
Render the scene so far
Trang 4Figure MTT.26: A render with Ray reflection enabled Note the subtle reflection, distorted by the bump mapping on the desks surface
Tip:
Raytraced reflections are enabled on the Mirror Transp tab
If you don't see any reflection in your render, use F10 to enter the scene buttons and make sure that the Ray button is turned On for the renderer
Trang 5Figure MTT.27: Enabling the Ray option in the Scene buttons
The whole surface is looking much more realistic However, real materials and surfaces will have subtle details on them that will tell the eye whether or not what it sees is "real", or at least
believable
Adding a History to a Material (Getting Dirty)
Close examination of a real desk surface shows polish and dust accumulation, as well as a few knocks and marks here and there If you can add these subtle hints to the material's history, you can produce a much more believable material simulation
A Material's History Can Be Broken Down Into 3 Possible Areas
Tip:
Adding dirt and irregular flaws will enhance a material's
believability
Trang 6Dirt
All real materials get dirty, either from accumulated dust or from interaction with liquids or staining substances
! Dust will collect in crevices
! Dirt will transfer from mucky hands or dirty objects onto a surface over time
Trang 7Figure MTT.28: A digital photo of coffee stained paper
The image above was created by placing a coffee cup on paper, allowing it to dry, and then placing the paper in a scanner I touched up the picture in a paint program to give more contrast You could also take a digital photo of the paper, or, if your 2D digital painting skills are
developed enough, just paint the stain pattern directly in the image editor of your choice For your convenience, the image file for this stain has been included on the CD
Image Textures
As with any decent 3D suite, you need a way of applying photographs, or graphic images created
in a paint package, to a material simulation Blender is no exception and has some wonderful tools that make the job easy
There are 2 strategies for applying an image to a texture
! Standard image mapping - where a picture is projected onto a surface from a single
direction, and;
! UV mapping - where a mesh is unwrapped to a flat surface upon which the image is placed This method allows precise control of how the image lays across the mesh model
Trang 8UV mapping is the preferred method of mapping for professional work, and you can learn about Blender's incredibly simple and powerful UV mapper (see Chapter 10) For this example, though,
we will stick with the basics
Mapping an Image to a Surface
Standard image mapping can use one of four methods to project an image onto a surface
Figure MTT.29: Blender's different image mapping methods
! Flat - Projects the image along the Z axis of the object The easiest way to think of this is like a texture up or down onto a ground plane
! Cube - Here the flat image is projected along each axis Therefore a cube would receive the same image on each of its six sides
! Tube - As its name suggests, the image is projected around the Z axis of the object from a central point In other words the projector pans around the tube
! Sphere - Here the image is projected from a central point in all directions
There will inevitably be some distortion if the object is not a perfect plane, cube, tube or sphere Fortunately, we only need to map a simple image to a plane You can therefore use Flat mapping without having to worry about distortion However, you also need to position and scale the coffee cup mark so that it appears to occur "naturally" Let's start by adding a new texture to your
desktop material
! With the desktop object selected press F6 to change to the Texture buttons
Trang 9! Select the next free available texture slot and select the Add New button
! From the available Texture Type rollout select Image
Figure MTT.30: The final Image that will be used for the texture
This is the image you will use for the coffee stain
It was created, as explained earlier, by scanning a real coffee stain on paper and adjusting the contrast in a paint program It was also converted to grayscale and inverted You will use the Map
To panel to add color later
! From the Image tab select Load Image and locate the coffee-stain1.jpg file
I will explain the settings in a moment, but for now those shown are the defaults
Trang 11Figure MTT.32
These are just the defaults, apart from setting the mixing mode to Add In a moment I will
explain the mixing modes in detail, but for now the reason I have set it to Add is so that it will be clearly seen on the desk surface
! Press F12 to render the scene
As you can see, the coffee stain has lightened the desk surface It is far too big, though, unless you are someone with a serious caffeine addiction The image has been mapped to fill the whole texture space of the mesh plane For our purposes we need to change the size, or scale, of the image and position it on the desktop in an appropriate place You can change the scale and
position of an image texture by altering the sizeX, Y, Z and ofsX, Y, Z ("ofs" stands for "offset")
in the Map Input tab of the Material buttons
There are several ways in which you can position and scale an image texture to a surface You will learn other methods later, but the one I show here will help further explain the Map Input controls and their uses
Map Input
Trang 12Currently the image is mapped to fill the entire space of the mesh This type of mapping is called Orco(ORiginal COordinates) in Blender and is the default As you can see from the Map Input settings there are quite a few others available Although you'll need to consult the Blender
documentation for a full explanation of all the settings, here are some of the more useful
attributes of the map input types:
! Glob(al): As its name suggests, the material will be scaled and oriented to the global ordinates This would mean that if the object moved in an animation the material would remain in place, giving the illusion that the object was moving "through" the material
co-! Object: With this type you can attach the material coordinates to another object such as an Empty The other object must be named and, of course, exist This is incredibly useful, as you can animate that other object to move, scale, and rotate, which causes the material to
do so as well
! Orco: The default mapping method; uses the object's texture coordinates If the object moves, the material will move with it In most circumstances this default works just fine
It is possible to translate the Orco coordinates in scale and position
! Win(dow): The texture is mapped as though being projected from the camera Therefore
if the camera moves so does the texture
There are other exotic mapping methods which, although useful, are not usually necessary for the majority of texture needs
Back to the Coffee Stain Texture
After playing around and using the preview render window, these are the settings that I found work best for positioning the coffee stain:
Trang 13Figure MTT.33: The final Map Input settings for the coffee texture
Size
! Set sizeX, sizeY, and sizeZ to 6.20
Position (offset)
! Set ofsX to -2.300, ofxY to 1.200, ofsZ to 0.000
If you find it odd that the sizeX, Y and Z buttons make textures appear smaller as their values increase, think of them as "how many times will the texture fit into the area" values Therefore, a number like 6.2 for the size values indicates that the actual texture image grows small enough that 6.2 of them could fit within the texture coordinates
If you render the scene now, you see a rather disappointing coffee stain that barely shows up, only appearing in the wood grain Why is that?
When you started creating the textures for your desktop you set some Warp and Stencil effects on previous texture layers These affect all textures below them Although the Warp effect can be
Trang 14turned off on a subsequent texture layer, Stencil cannot This means to get an undistorted coffee stain, it really should have been the first texture
Reordering Textures
You may have wondered what those up and down arrows were in the Texture panel of the
Material buttons These give you access to a temporary storage area called the buffer You are able to copy a selected texture to this buffer then paste it into another texture slot All material settings, like Map Input and Map To, are copied with the texture
Figure MTT.34: The copy and paste buttons for texture channels
To move a texture down one slot, you must first select it, choose the "Copy" button, select the channel below it, and choose "Paste" Start by moving the coffee texture down several slots, then proceed up through the stack, moving each entry down one level Finish by making a copy of the coffee texture and pasting it into the topmost Texture slot You should end up with this:
Trang 15Figure MTT.35: The Texture stack after shifting and duplicating
You will notice that the Texture stack shows that there are now two copies of the coffee stain texture in this material Don't worry about that, as you can use the other copy for a nice special effect in a bit However, LMB the checkmark by the second coffee stain texture to temporally turn it off while you set the Map To settings for the first
Tip:
The copy and paste buttons are used to rearrange the
texture stack
Setting the Map to Options for the First Coffee Stain Texture
With the first texture slot selected in the Material buttons, select the Map To panel so that you can set the way this texture will be combined with the material color The Mix blend mode will mix both the black background of the image as well as the stain mark itself You need to get rid
of the black background Once again Blender has the ability to do this
Trang 16! Switch to the Texture buttons (F6) and in the Image tab select CalcAlpha and UseAlpha This will make the black area of the image transparent
NOTE: Alpha (opacity), in materials, is quite complex, and even experienced users find
themselves trial-and-error toggling alpha related buttons from time to time to get things just right
If things don't work exactly as you expect at first, don't lose hope!
! Switch back to the Material buttons I am sure you don't need to be reminded of how to do that (HINT: F5 No more hints.)
! F12 to re-render
Quite a subtle effect has now been produced The stain has slightly bleached the surface, and because the coffee contained far too much sugar, the specular and reflective difference between the normal table and the stain can be seen
You can now use the second copy of the coffee stain texture The image texture itself is shared between the two slots, but each instance here can have its own unique Map To settings
! Set Col and Nor on to give you both color and a bump map effect
! Change the blend mode to Subtract to give a darker color to the stain
! Change the Col slider to around 0.50, so the new color isn't overpowering
! And set the Nor value 2.00 to increase the bump size
Trang 17Figure MTT.36: The Map To settings for the second coffee stain channel
A full render at this point will show that some of the wood grain has become darker, as though coffee has spilled and dried in the crevices However, it's a bit random Why might that be?
Order of Textures and Their Effects on Each Other
Previously you set both a Stencil texture to mask some areas of following textures, and a Warp
Once a Stencil is set, it applies to all following textures A Warp, however, can be switched off further down the stack
! Select the texture slot immediately before the last coffee stain texture
! Set Warp to "on" but make sure the fac(tor) amount is set to 0.00
Trang 18Figure MTT.37
These settings tell Blender that all following textures should have no Warp
Trang 19Figure MTT.38: The final render
The desktop is now a reasonable simulation of the reference, with a few artistic interpretations and additions, such as the coffee stain, on its surface
Through thinking about and carefully observing materials in the real world, you have a
reasonable chance of using Blender's tool to make a believable approximation of those materials Combined with decent modeling and good lighting, working in this fashion can lead to
significantly more believability in your renders