Greetings!

Welcome to Scifi-Meshes.com! Click one of these buttons to join in on the fun.

Local TutorialBlender For The Faint Hearted - 06 : Material Basics, part 2

SphynxSphynx195 Posts: 461Member
Blending for the faint hearted - Sphynx's guide to Blending

Tutorial 6: Material Basics, part 2
In this tutorial, we'll be exploring more of what we can do with simple materials, without the need to resort to adding textures. Most of this tutorial builds directly on Tutorial 5 however, so before doing anything else with this tutorial, load the basic Tutorial 5 blender file (Tutorial5_00.blend) and resave it with an appropriate name for this tutorial (e.g. Tutorial6_00.blend).

By now, you should be pretty familiar with loading files, modifying settings and rendering test images. As such, there will be a sudden drop in hand-holding in this tutorial that will set the stage from here on. There will an increasingly fewer number of explicit 'try this' type exercises A– if you've got this far with the tutorials, you should be practiced enough to do it yourself without prompting.

More on Reflection
We've already looked at reflection colours with the [Mir] slider, but one of the important thing about setting reflection colours may not have been obvious. This is namely that while light is being reflected from the object, this in no way controls the actual reflection of other objects. Sit another mesh next to the cube that we built in Tutorial 5, and even with all of the reflection settings that we have already used put all the way up to max, the other mesh might as well be a vampire. It is going to have no refelection at all. It's time to introduce Raytracing.
sb006_001.jpg

Older versions of Blender needed to produce true reflections with a very convoluted method A– so convoluted infact, that we are not even going to touch on the subject here. We don't need to, as those kind guys at Blender have introduced the Raytracing features of the rendering engine. In order to turn on Raytracing, jump to the [Render] menu or press [F10], and toggle the button marked [Ray]. If the button marked [EnvMap] is turned on, you can turn this off now A– it won't have any useful effect in Raytracing mode at all.

Follow the next small exercise to get us something to reflect.

Exercise: Adding something to reflect
Add a UVSphere and accept the default number of segments and rings. Hit [Tab] to switch into object mode, [n] to display the dialog, and change it's location to LocX=1.5, LocY=0, LocZ=0.5 A– which should be just off the right-hand side of the cube, as we are looking at it on screen. Change its size in all dimensions to 0.25, which should make it about one-quarter the size of the cube. You can set the sphere to smooth if you want, just to get rid of those polygon facets.
sb006_002.jpg

Jump to the Shaders panel (F5) and add a new material to the sphere A– call the data block 'Sphere Material'. Set its colour to R=1.0, G=0.25 and B=0.25.

Once you've done this, save the blender file again, so that the default file for this tutorial now has two meshes in it.
Select our cube again, and switch to the [Shaders] page or hit [F5]. We should see our [Cube Material] being displayed with its 'blue' preview. Remember that second page of buttons that lies under the [Shaders] page, called [Mirror Transp]? Click it now and bring it to the front A– these are the buttons that we need to look at.

At present, the mirror-reflection features of Blender are turned off A– we can turn them on by clicking the button marked [Ray Mirror]. This tells Blender to start calculating reflections from other objects for this material. Hit [F12] now to see what it looks like.

No change? Of course not A– as always, we need to look at a few more settings before you get anything worthwhile on screen. This is not Blender needing more configuration than necessary, but simply that the default settings for all materials tend not to have these special features configured in such a way that they would show anything in a render A– at the end of the day, a non-reflective object is not going to act like a mirror regardless of whether [Ray Mirror] is turned on or off.
sb006_003.jpg

The four buttons that we need to look at all all directly under the [Ray Mirror] button A– the most important one to get anything displayed being [RayMir] with its slider, currently set at 0. This setting tells Blender how reflective the surface actually is. A setting of 0 is non-reflective, while a full setting of 1 is a perfect mirror. Remember however, that the higher you make this setting the more reflective an object is going to be, but also the less of its own colour the object is going to appear.

Exercise: Playing with Ray Mirror
Turn on [Ray Mirror] and try an [F12] render. Take a look at it's appearance, then set the [RayMir] value to 0.5 and take another look. Finally, set [RayMir] to 1, and see what it looks like now A– study the differences in each setting in regards to how both the reflection and the object colour is affected.
sb006_004.jpg sb006_005.jpg sb006_006.jpg

Save these blender files down if you want to, increasing the number in the filename, but remember to reload Tutorial6_00.blend before the next exercise.
You may notice, depending upon the speed of your PC, that the render is now taking a little longer. It may not be noticeable as much at present as the scene is quite small A– once it needs to reflect much more however, your render times may increase drastically.

You may also be given the impression that the cube has become transparent A– don't worry, it hasn't. The lines that you appear to see through the cube are actually the lines in front of the cube reflected back out again. It's just an optical illusion that we could cure by moving the camera a little, but we'll just leave it for now.

The other values in this section, we will talk about but not render. It is a little harder to fully demonstrate their effects without a more complex scene.

[Depth]
Place two mirrors opposite each other, and you get a great effect of images reflecting back and forth into infinity. Place two mirros opposite each other with a camera around, and you've got problems A– cameras just wern't designed to cope with it, and neither, really, were 3D applications. Someone needs to tell the computer when to stop. That's what this setting is before A– it is the 'depth', or the amount that the rendering engine will actually try to reproduce this optical illusion. Don't make the mistake of putting this setting too high A– you may suddenly find that your PC is dragged down into calculation hell!
sb006_007.jpg

[Fresnel] and [Fac]
[Fresnel] and [Fac] can be a little hard to explain, so forgive me if I jump straight into a metaphor. Imagine a pool of water A– say a swimming pool, a bowl, or even a puddle of rain-water on the ground. Look directly into the water, and you can see straight through it. The bottom is perfectly visible as the angles of reflected light means that more than enough of it comes back at your eye to give a good image.

Start to lower your eyeline to the ground however, while looking into the distance, and things start to change. Imagine being in the swimming pool for example, with your head just above the water and looking towards the other side of the pool. The closer your eye-level gets to the level of the water, the less of the bottom of the pool is visible A– it does not go out of your visibility, it is an optical effect that masks the bottom because of where all of the light rays are being reflected.

The [Fresnel] and [Fac] values are used to simulate this effect. The higher you set the [Fresnel] value, the less of the bottom surface is going to be seen A– set it to 1, and the surface is going to be totally reflective even if viewed directly from above. The [Fac] value is used to set the overall intensity of the effect.

More on Transparency
OK, back to Transparency. If you remember, these are the buttons that lie in the middle of the [Mirror Transp] page. We've already taken a look at [Ztransp] in order to get a proper transparency effect showing in Tutorial 5. Now however, we are using the Ray Tracing engine, so select the cube, go to the Shaders panel using [F5], and click on the [Ray Transp] button A– the [Ztransp] button will toggle off automatically as these two buttons are mutually exclusive. We must do this now, as some of the effects that we are going to look at simply won't have any effect under the normal [Ztransp] feature. In actual fact, you should see a general improvement in your transparent surfaces anyway, now that [Ray Transp] is turned on.

For some of these transparency exercises, we now need the sphere to be at least partially behind the cube. Do this by selecting the sphere, hitting [n], and changing its location to LocX=0, LocY=2.0 and LocZ=0.5. Also, modify the [Alpha] setting of the cube to 0.25 so that it is partially transparent. Save this scene down as Tutorial6_01.blend (or your next number) so that we have something to re-load if needed.

The [Depth] button allows us to set how many layered faces will be buffered behind the transparent materiual. If we have three layered cubes for example, all of them transparent, this means that six faces could potentially overlayer each other, going into the distance. The [Depth] button allows us to state how many of these faces are actually buffered in the image displayed behind the transparent material. I usually find that the Blender default of 2 is not sufficient for my needs A– you don't need to go overboard however, as layered transparent faces will naturally become more indistinct anyway, so much higher values will not really have any effect other than to increase your rendering times.

As with the Reflectivity settings that we discussed above, Transparency can also be modified by the Fresnel effect. The default setting of 0 means that transparency is calculated evenly across the entire objects surface. Increase the [Fresnal] and [Fac] settings, and the effects of transparency change according to where you are looking at on the object surface.

A good example, is with a spherical or curved surface A– such as a the side of a bottle. Look directly at the surface, and it will appear most transparent. Look towards the edges of the bottle, where we are looking through more and more of the glass as the surface curves away from us, and while still clearly a transparent surface it begins to appear more and more dense.

Exercise: Changing the Fresnel and Fac
For this exercise, it would be best to have a sphere rather than a cube, so we'll modify our cube a little using subdivision. Remember how to do this? Select the cube, go to the Editing panel (F9) and hit [SubSurf] A– take the render subdivision level up to 3 and turn on [Set Smooth]. This will shrink the cube however, so hit [n] and temporarily increase its size to 1.5 in all dimensions. Save this file as Tutorial6_02.blend (or the next number) if your want, in case you want to come back to it.
sb006_008.jpg sb006_009.jpg sb006_010.jpg

Play with different settings of Fresnel and Fac and see how they effect our 'cube'. In theory, increasing the Fresnel will make the edges of the surface appear more solid, but don't be overly concerned if you can't get the hang of it A– it is not as easy as it seems. My best advice is to try the system out on a sample object as and when you need to use it. In my experience, the effects of Fresnel can be wildly different on different object shapes A– just as in the real world. To see the two extremes, try rendering your image with a Fresnel of 0 and at the maximum of 5. When you are finished, return the Fresnel to 0 as we will be using this same scene for our next exercise A– but save it if you want to.
Note: The sample images have been produced using our 3 lamp rig A– this rig is better than a single direct light, but it's still not perfect. The bright light in the centre of the blue 'cube' is caused by the convergence of all three spot lights in one area. In reality, you would use a much softer and more general lighting rig to get the correct transparency effects.

Different substances do not allow light to pass through them with the same results. Dense and less dense materials 'bend' light as they pass through, and spherical objects may have a lens effect to such an extent that images on the other side can even be totally inverted. We can simulate this effect by using the [IOR] button, or Index of Refraction.

Exercise: Changing the Index of Refraction
Render the existing scene using [F12] and take a good look at it A– in particular the appearance of the ground-plane behind the 'cube' and the red-sphere where it 'cuts' through the transparency . Increase the IOR by 0.01 at a time, re-rendering each time. It does not take much to make a difference A– the official difference in IOR between ordinary glass, specialised glass and Diamond for example can literally be points. Save down your scene if you want to, but reload the Tutorial6_00.blend file before the next exercise.
sb006_011.jpg sb006_012.jpg sb006_013.jpg
The [Zoffs] button is only really for use during normal (as in non-RayTraced transparency), and is intended to give an artificial offset in the Z Buffer when using [Ztransp]. The maximum offset that is possible is 10, but frankly I never use it. To me, unless you really are experimenting with a particular scene this facility looksartificial, which is why I am not going to go through it here. If you want to experiment with this, load up your non-Ray Trace transparency file from Tutorial 5 and give it a go. If this type of realism is required however, I'd personally recommend going straight to [RayTransp] and doing it properly.

Other buttons in the [Mirror Transp] page
There are a few other buttons on this page that we might as well go through now, just to finish off.

[OnlyShadow]
The [OnlyShadow] changes the material to only display the shadows that are falling on it, and not any of the other material features.

Exercise: Using [OnlyShadow]
With your standard Tutorial6_00.blend turn on [Ray] on the [Render] menu (F5), and [RayTransp] with the [Alpha] set to about 0.25 for the cube material, then hit [F12] to render it. Take a look at the standard transparent cube.
sb006_014.jpg sb006_015.jpg

Now turn on [OnlyShadow] for the cube material and render it again. Your cube should disappear, but there should still be a faint outline A– this outline is what remains of the cube when it is only displaying the shadows that fall on it. In this case, most of these shadows are actually being caused by its own transparent faces.

[NoMist]
The [NoMist] button is something that we can't really demonstrate at present. We could set up a quick World environment to generate some mist, but it's a little 'blunt object' and would not illustrate this feature properly, so we'll leave it till later.

The [NoMist] button effectively tells this material to ignore any mist values that have been setup, and to render normally.

[Env]
It would be easy to say that the [Env] button effectively 'disables' the material so that it does not render, and lets the surrounding environment show through. It is however, not as simple as that as the material does not become 'invisible' as such, it actually acts much like an 'alpha mask'. If an object is placed behind the material therefore, it too is not rendered A– you can look upon this feature as making the material render as the environment, rather than turning the material off.
sb006_016.jpg sb006_017.jpg
Exercise: Trying the [Env] button
Load your Tutorial6_01.blend file A– the one with the sphere behind the cube. Render it up and take a look at it. Now turn on the [Env] button for the material, and render it again A– you should see a empty black space where the cube would be A– notice as well, the absence of the sphere behind the cube.

Strictly speaking, this is not just a 'black space', but is actually displaying the general environment. If the environment was actually red, this space would also be red. If a picture of the sky, then the space would be the picture of the sky.

[SpecTra] (Specular Transparency)
The [SpecularTra] button is used to make specularity on transparent materials become opaque or transparent A– simple as that. The higher the setting, the more transparent the specularity is A– the default for this setting is fully on.

Exercise: Trying specular transparency
Load your Tutorial6_01.blend A– the cube should already be transparent. Render the scene using [F12] and fix it in your mind. Now take [SpecTra] all the way down to 0 and render it again A– you should see that the specular areas render more as you'd expect the solid cube to be. They are more solid and 'brighter'. Keep this scene for the next exercise, but return the [SpecTra] to 1.

[Add]
The [Add] button 'adds' brightness to transparent materials A– the higher the value, the more 'glow' can be seen. The official description is 'Sets a glow factor for transparent materials' A– yeah, well, maybe. What the description does not tell you, is that this facility only works when you have [Unified Renderer] turned on in the Render panel (F10). Even then however, I hardly ever (if at all?) see any difference, and tend instead to add a small amount to the [Emit] setting instead.

Exercise: Using [Add] to display glow
Use your scene from the last exercise so that the cube is already transparent. Render it, and fix the image in your mind. Now turn the [Add] value up to 1 and re-render. Don't worry if you don't see much difference A– I never do either.

More on Shadows
While we have recently turned on Ray Tracing, we are still actually using Buffered shadows. I've done this deliberately, as while ray traced shadows are more accurate, they would also be a little confusing. Why?

Well, lets try an experiment A– open Tutorial6_01.blend. That's the one with our cube already set to be transparent. Jump to the Shaders panel (F5) and select each of your lamps in turn. Toggle [BufShadow] to [RayShadow] A– they are mutually exclusive, so you can only have one turned on at any one time. Now hit [F12] and render the scene. You'll notice that it immediately looks far too dark.

Why? Well, its a bit of an optical illusion really. The reason for it is that you are looking at well lit but transparent cube, but all of the shadows are dark and solid as if the cube was not transparent at all.
sb006_019.jpg

To correct this, we can now take a look at a button on the Shaders panel that I told you to ignore in Tutorial 5. Select the Ground Plane (remember that shadow buttons are set on the material that the shadow is going to fall on A– not what is casting the shadow) and turn on [TraShad], then hit F12 again A– this corrects the problem, and accounts for both the transparency and tinting colour of the material.
sb006_018.jpg sb006_020.jpg

A quick note: On that last render, did you get strange effects on the base of the cube? Maybe some strange 'random noise' or patterned lines running across the screen? If you did, this is because Blender has been having some problems in rendering this section of the image. Why? Well, what is in that area of the scene is both the base of the cube and a section of the ground plane A– both occupying exactly the same space and competing for priority in the image. In real-life, that simply does not happen. The easiest way to correct this to to mimick real-life. Select the cube, hit [n] and change the LocZ to 1.001, lifting the cube just a fraction of a millimetre off the ground plane and preventing the two mesh faces from touching. Hit [F12] again, and you'll see a nice clean render.
sb006_021.jpg

What's left?
We are about to delve into multiple materials, the concept of Ramps and Halos (we won't look at their use in detail until a later tutorial), as well as finally starting textures and UV materials. By now, I hope that you can see that there is plenty that you can do at a general material level before resorting to adding textures. There are however, a few buttons left that we can deal with in terms of general materials before we move on. All of these are on the main [Materials] panel.
sb006_022.jpg

[Shadeless]
As the name suggests, shadeless renders the material without the nice, calculated shade that is the culmination of all of the transparency, reflection and other aspects that would modify the degrees of shading across the material surface. Turn on this button, and the entire material gets the same, plain level of shading.
sb006_023.jpg

[Zinvert]
The [Zinvert] button inverts the order in which the faces of the material are rendered. This can give you some strange effects, and it is really up to the individual to try it out to get the desired effect being sought. There are some specific uses that you can put this to, but we'll leave them for this level.
sb006_024.jpg

[Wire]
The [Wire] button tells Blender to render all faces with this material in wireframe mode instead of solid.
sb006_025.jpg

[Full OSA]
This buttons tells Blender to implement the full OSA level for this material, regardless of what level it is set to for the scene as a whole. It does however, still need to be turned on in the first place A– if it is turned off, then this button still won't smooth the edged. We have deliberately not looked at OSA yet, as it is more a part of the Rendering tutorials, but for a quick summary it is the anit-aliasing algorithm that is used to 'smooth' the edges of shapes on screen.

I've been using OSA in many of the sample images just to improve image quality, but while just setting up your scene, it is not important. The higher the OSA setting (this button turns it fully on for this material, so you have no choice), the longer it will take to render the scene A– especially as we are corrently using Ray Tracing.
sb006_026.jpg sb006_027.jpg

If you do not have a PC with speed to burn, just leave it off for these tutorials A– it is more important to quickly see the results of any settings that you change, and not to get a nice flashy image.

Attaching Multiple Materials
So far, we have only really looked at attaching a single material to the entire mesh. Now it's time to look at attaching multiple materials, specifying which faces that they effect. Start by loading Tutorial6_00.blend so that we get our initial, unmodified cube back. Render it up using [F12] so that we can remind ourselves what it looked like.
sb006_028.jpg

Select the cube and zoom in (if you can remember how to do it!), then jump into edit mode using [Tab]. It might be easier for this exercise to rotate the view slightly (say, into three-quarter view) so that it makes selection of faces a little easier. Go into face selection mode, and select the face nearest the camera A– the one that we've been using most of the time, such as when we created our sub-divided box.
sb006_029.jpg

The buttons that we want for this are on the [Editing] panel (F9), and are in a section marked [Link and Material]. Currently, there will be a section labelled 'Cube Material' and displaying a blue colour preview along with the words '1 Mat: 1' A– this is effectively the 'current' material. The current setting is not surprising really, as this is the only material that we have actually created on this object.

Click the button beneath this material sample however, labelled [New] and Blender will create a new material index on the mesh, and set the currently selected face(s) to be of the new index. Within the object [OB], or if we have used them instead, each Material Entity [ME], we can have a maximum of 16 individual material indexes. One of the buttons should now have changed to '2 Mat: 2', indicating that there are now 2 materials in existence, and the 2nd is selected. Try selecting the arrows on either side of this area and it should allow you to move back and forth between the first and second material.

Other than the number changing however, nothing else is happening is it? Well, yes A– it is displaying the details of each of the materials as you select it, but it just so happens that all of the information has been inherited from the material that was there previously. While we therefore have 2 separate indexes A– one assigned to the bulk of the cube, and one assigned only to our selected face A– both indexes currently have the same material data-block attached to them. Lets change that now.

With the second material selected (the label needs to say '2 Mat: 2'), switch over to the Shaders panel (F5) which will display our familiar blue 'Cube Material'. You will notice that the number next to the data-block name [MA:Cube Material] now says 2 indicating that it is currently attached to two users. Click the up-down arrow next to this name, and select [Add New] from the menu, and immediately change its name to [Cube2 Material]. You will notice however, that nothing else has changed A– that is because when you created the new material, it inherited all of the details of the one that was already selected. In fact so much so, that it needed to add a number onto the end of the name to ensure that the name of the data-block was not duplicated.

So that we can see that we do really have a new material, change its colour to R=0.25, G=1.0 and B=0.25.

Switch back to the [Editing] panel (F9) and take another look at the [Links and Materials] section. We now should have a very different material preview showing. Click the arrows again, and you should be able to visibly tell the difference between the two materials. Render the scene using [F12] to prove that we have successfully attached a new material to that single face.

Er, hang on A– it all rendered blue! What's going on! Well, while we have created the material and the material index, we haven't explicity assigned it to the face. The face should still be selected, so now hit the button [Assign]. No visible effect A– but this time it has been done. Hit [F12] again, and we should see the results of our assignment.
sb006_030.jpg

There are four more buttons in this same section that also need explaining. First of all the obvious one A– while [New] created a new material index, [Delete] logically deletes the current index selected. Be carefull with this, as once its gone A– its gone. There is no going back. Remember though that in keeping with data-blocks, you've actually deleted the link A– the material that you created would still exist. You can not however, delete a material in edit mode A– switch to object mode using [Tab] and do it from there. Any faces that had this material index will revert to the immediately prior index. If you deleted the green material for example, it would revert to the blue one.

The remaining three buttons are all about selecting either the material based upon a part of the mesh, or selecting a part of the mesh based upon the material.

The [?] button will jump to the material index based upon the currently selected face or index. Try it A– select the Cube Material (the blue one) in the [Links and Materials] area, the select the face that you made green. Now select the [?] button, and it will jump to the Cube2 Material index.

The [Select] and [Deselect] buttons will additionally select the part of the mesh that has the currently displayed material index assigned to it. Note the word additionally A– this feature does not deselect the rest of the mesh first. If you have some faces selected, then select based upon the material, they will all be selected A– old and new.

Try it. Deselect everything using [a] then choose one of your material indexes. Choose the [Select] button and only the faces with that material index will be selected. Try the opposite as well A– select everything using [a], then select one of your material indexes. Now choose the [Deselect] button, and all faces with that material index will be deselected.

Ramps
We'll only look at the concept of Ramps in this tutorial, as while the concept is relatively simple to understand, their range of uses really needs its own tutorial. The Ramp controls are on the Shaders panel (F5) beneath the [Materials] buttons.
sb006_031.jpg sb006_032.jpg

Initially, the Ramp panels only contain a toggle button to switch back and forth between Colour Ramps and Specular Ramps, with each displaying a single button called [ColorBand]. Selecting this button creates a new ramp for the material of the specified type.

Blender implements Ramps as a colour band that is applied to the surface of the material, which is editable by the user to the requirements. There are various input to the Ramp algorithm, with information coming from the [Shader], the [Energy] or the [Normal] of the material. The Ramp algorithm is able to use this information to modify the material in a number of differnet ways A– mixing, lightening, darkening, and multiplying the colours to name by a few.

There are a wide range of ways to use Ramps A– giving some very interesting and special effects. Some of the most common ways of using Ramps are to add varying degrees of subtle colours to skin and soft-fruit.

Halos
Again, we will only look at the concept of Halos here, as there is a lot that we can do with them. They are an very useful tool when creating particles, for example.

As a very quick summary of Halos, any material set to be a Halo is not rendered in the same way. Instead of the faces of the material being rendered, it is the vertices that become the focus of the material A– each vertex becomes its own pin-point of light, with a range of halos, and star effects possible to be assigned. No wonder then, that halos are so important in the generation of particle effects.

What's in Tutorial 7?
In
Sign In or Register to comment.