Blender Tutorial

Blender TexMesh Tutorial
 
 
Skill Level:          Beginner (Tutorial assumes user knows the basic functions of Blender).

Blender Version: 2.37a

Tutorial Version: September 22, 2005

Resources: N/A

Remarks: A tutorial which describes the use of UV Mapping and NURBs to obtain similiar results to those using the TexMesh method can be found at:
               UV Mapper Tutorial   ( The UV Mapper Tutorial assumes that you have read at least the 'Introduction' and 'Application 2' sections of the TexMesh Tutorial ).



Figure 1. TexMesh.



Quote from the on-line Blender Documentation  (  http://download.blender.org/documentation/htmlII/x6824.html  )  :

TexMesh
Enter the name of another Mesh block here to be used as the source for the texture coordinates. Morphing-like effects can then be achieved
by distorting the active Mesh. For example, a straight stream of water (as an animated texture) can be placed in a winding river.




Introduction.

This tutorial is designed to provide a step-by-step procedure to demonstrate the capabilities of the Blender TexMesh feature.



Step 1: Set up the necessary Mesh Geometry.


1.1. While in Top view (NumPad 7), delete [x] the default cube and Add (Shift+a) a mesh Plane.

1.2. In Edit mode, de-select (Shift RMB (Right Mouse Button)) the lower right vertex and delete the currently selected 3 vertices.
Select the remaining vertex and move it 4 grid units to the right (Positive X direction).

Figure 1.2. Vertex placement.


1.3. Switch to the Edit Buttons Window [F9]. In the 'Mesh Tools' panel adjust the 'Steps:'setting to 10. Change the 'Offset:' setting to a value of 0.2 .
'Steps:' sets the number of times the Extrusion operation will be repeated (when used with the 'Extrude Dup'licate button).
'Offset:' controls the distance (in Blender units) that the selected vertices will be extruded.

Switch to Front view [NumPad 1] and press the 'Extrude Dup' button.

Figure 1.3.a. ExtrudeDup Settings.

(Note: The Extrude Dup feature extrude duplicates the selected vertices perpendicular to the view that you are in).
So although at first glance, it appears that nothing happened, if you switch to Top view, you will see:

Figure 1.3.b. Extrude Dup.



1.4. In the 'Mesh Tools' panel adjust the 'Steps:'setting to 50. Leave the 'Offset:' setting at a value of 0.2 .
Select all the vertices, then switch to Side view [NumPad 3] and press the 'Extrude Dup' button.

Figure 1.4.a. Extrude Dup Final Result.

(Note: We could have simply added a Grid from the start, but I find that using the Extrude Dup feature provides more precise control over vertex placement).
[Tab] out of Edit mode, and in Top view, move the mesh Plane down 2.5 Grid units.
Tip: Hold Ctrl down to move the Plane full units, then also press Shift down to move it the rest of the way.

Figure 1.4.b. Plane Moved.


Step 2: Assigning a Material and Setting up the Camera and Lamps.

2.1. In the Material Buttons Window [F5], assign the material: 'Material' that use to belong to the default cube to the mesh Plane. In the 'Material' panel set the color to white (R = G = B = 1.0) and press the 'Full Osa' button. In the 'Shaders' panel, reduce the 'Spec' setting slightly to 0.2 .

Figures 2.1.a. and b. Assigning a Material.

Figure 2.1.c. Material Adjustments.

2.2. Ensure that you are not in Edit mode, then in top view, duplicate the Plane and move it up (Positive Y direction) 5 grid units.
(Note: By assigning a material prior to duplicating the Mesh Plane, both mesh planes - 'Plane' and 'Plane.001' now share a common material named 'Material'. Also, in the next step where we configure the texture for this Material, both Planes will consequently also be sharing the same texture -> in Blender lingo a multi user as opposed to a single user).

2.3. Select the camera and press Alt+g and Alt+r to clear its location and rotation. Then move the camera between the two planes and in a side view, move it up about 12 grid units. If you switch to camera view mode, you should see both planes within the outer dashed rectangle.

2.4. Switch back to top view and move the Lamp so that it is between the planes and off to the right. Duplicate the Lamp and move it to the left.

Figure 2.4. Scene Set up.


Step 3: Applying an Animated Texture.


3.1. Select Plane.001 , and switch to the Texture Buttons Window [F6]. In the textures panel, select 'Plugin'.

Figure 3.1.a. Select a Texture Plugin.

(Note: If you don't have the dots2 texture plugin, obtain it from here: dots2.dll (dots2 texture plugin author: Bernd Breitenbach; Windows version compiled by the IcemAn).

For other Operating Systems, plus more information including documentation on this plugin (and others) check out the:   Blender Plugin Repository


Once you have downloaded the texture plugin, store it in your texture plugins directory.
(Note: You should set your 'File Paths' (located in the top Information Window in Blender) for your convenience, so that when you go to load a texture plugin, Blender will automatically open up a File Window set to the file path you entered in the 'Texture Plugins' field'. Otherwise, the first time you wish to load a texture plugin, you would have to search through your directory system to find it. After we've finished this tutorial, and once you have saved (F2) your work; you should start from a fresh Blender run (Ctrl_x), re-enter the 'File Path(s)', and then save it as your default start Blender file by using the command Ctrl_u (and confirming the prompt "Save user defaults") in order to make your changes permanent).

Figure 3.1.b. Setting your Texture Plugin File Path.


In the 'Plugin' panel that appears, press 'Load Plugin' and select the dots2 plugin from the File Window, and MMB (Middle Mouse Button) click to load the plugin.

Figure 3.1.c. Select the Dots2 Plugin.


In the dots2 settings, press the 'Bump' button and adjust 'Bump Size' to 5.0 . This is to simply make the dots 'stand out' a bit more.
(Note: To have the dots rendered with 'bumps', you also need to set 'Nor' in the 'Map To' panel in the Material Buttons Window. Also, I increased the Nor slider slightly to 1.0).

Figure 3.1.d. Adjusting Dots2 Plugin Settings.


If you render now, you should see that the dots are stretched in the x direction.

Figure 3.1.e. Stretched Dots2 Texture.


To get them looking more like dots, switch back to the Material Buttons Window, and in the 'Map Input' panel adjust 'SizeX' to 7.5 and 'SizeY' to 1.4 and then render again.

Figure 3.1.f. Adjusted Dots2 Texture.


Now to animate the texture.
Split the 3DWindow vertically and change the right side window to an IPO Curve Editor window. Change the IPO curve type in the IPO Curve Window header from 'Object' to 'Material'. From the channel list on the right side, select 'OfsX' using LMB.
Add two curve points by Ctrl_LMB clicking on the 3Dgraph portion of the IPO Curve window. For the first point, click near the co-ordinates X = 1, Y = 2; and for the second point: X = 100, Y = 0.

(Note: You may need to scale the window slightly to add the points. Also, don't worry about placing the points accurately at this point in time, since we will be editing the points later to make them exact. Just try to get them close for now).

Press 't' and make the curve type 'Linear' from the popup menu that appears. Then press 'n' and enter the values for the two curve points:

(Point 1: Xmin = 1.0, Ymax = 2.0 ; Point 2: Xmax = 100.0, Ymin = 0.0).

(Note: If you accidentally enter a wrong number in the numeric entry panel, it is possible that the 'min' and 'max' values may become flipped and can no longer be adjusted as shown in Figure 3.1.g. If this happens to you, simply press [Tab] to enter into edit mode for the IPO curve and move the points on the curve manually or enter the value in the correct field in the expanded input field numeric entry panel that appears when the IPO curve is in Edit mode).

Figure 3.1.g. Animated Texture IPO.




Step 4: Applying TexMesh.


4.1. Select the mesh Plane, and switch to the Edit Buttons Window [F9]. In the 'TexMesh' text entry field located in the 'Mesh' panel, type in the name of the Mesh data block that will be used as the source for the texture space: 'Plane.001'.

(Note: Be carefull to type the Mesh Data Block name in exactly; if the mesh data block name entered does not exist, Blender will clear the text entry field).

Figure 4.1.a. Setting TexMesh (Mesh Data Block Texture Space Source).


(Note: For future reference: It is important to remember that it is the mesh data block name that should be entered in the 'TexMesh' text entry button NOT the object name. In cases where you have deleted or duplicated some meshes, the mesh data block name may no longer match the object name; so be carefull to enter the right one. For example, in Figure 4.1.b. below if Plane/Plane.003 is the active mesh, you would type the name of the mesh data block Plane.004 into the 'TexMesh' text entry field, NOT the Object name Plane.001 . If you're using the TexMesh feature in the future, and you see that the effect is not working properly, this would be the first thing to check).

Figure 4.1.b. Mesh Data Block vs Object Names.


4.2. Now we're all set to modify the mesh Plane's geometry. In edit mode, select the center column of vertices. Activate Proportional Edit mode by pressing 'o', and adjust the falloff property to smooth by pressing Shift_o. Adjust the region of influence by pressing NumPad + or - and move the vertices up to obtain something similiar to that shown below in Figure 4.2.

Once you're done editing the mesh, toggle Proportional Edit mode off by pressing 'o' again, and then exit Edit mode.

Figure 4.2. Distorting the Active Mesh Plane.




Step 5: Ready to Render.


5.1. Switch to the Display Buttons Window [F10].
Change the End Frame located in the 'Anim' panel to 100.
In the 'Format' panel, change the file format to 'AVI RAW'.
Set the render size to 640 by 480, and set the scaling factor to 50 percent for a final rendering size of 320 by 240.
In the top text input button located in the 'Output' panel, enter a name for the animation: texmesh_01.avi (Be sure to enter a valid path).
If you want a better quality render (at the cost of longer rendering time) press the OSA button located in the 'Render' panel, and select a number below corresponding to the desired level of quality (5 = low ; 16 = highest quality)


Figure 5.1. Display Buttons Window Settings.


5.2. Press the 'ANIM' button in the 'Anim' panel and wait for all 100 frames of the animation to be rendered. Once Blender is finished, press the 'Play' button in the 'Anim' panel to view the animation. To exit Animation playback mode press [Esc] on your keyboard. Press [F11] to push the Playback/Render window to the background. A still frame from the animation is shown below in Figure 5.2.

Figure 5.2. TexMesh Animation Demonstration.

TexMesh Animation   DivX AVI format, ~664 kB


Well that's the basic idea behind TexMesh.

For those interested in a more 'in-depth' look into the TexMesh feature ( or for those having trouble sleeping ;), I've included some additional sections below.




Behind the Scenes.


One small, but important detail that I didn't mention in the above procedure is that the default 'Map Input' mode of Orco (Original Coordinates) is used.

Figure 1. 'Map Input' Mode.


If you activate the 'TexSpace' Draw Extra option located in the 'Draw' panel of the Object Buttons window, for the example above, you will see that the texture space of the lower Mesh Plane is twice the height compared to that of the texture space source Mesh Plane.001 .

Figure 2. Mesh Plane's Texture Space.


Now, if the entry 'Plane.001' is erased from the 'TexMesh' property of 'Plane', you obtain the result shown below in Figure 3. Remember that 'Plane' and 'Plane.001' are sharing the same material and texture. Once the 'TexMesh' entry is cleared, it will revert back to using its own texture coordinates as indicated by the dashed rectangular outline in Figure 2.

Figure 3. TexMesh Switched Off.


After scaling the texture space in half vertically and moving the texture space down to match the lower part of the mesh 'Plane', (using the Texture Grab/Move and Scale command: 't' in object mode) you obtain the result shown below in Figure 4.

Figure 4. Texture Space Adjusted for Plane.


If you watch the animation when the TexMesh feature is de-activated, it's apparent that the texture no longer is affected by the changes in the mesh Plane's geometry. I've included the animation with the TexMesh feature de-activated to save you time rendering it: texmesh_off.avi    DivX AVI format, ~976 kB


Looking back at the animation which uses the TexMesh feature, if you look closely, you might notice that the dots 'distort' somewhat as they go around the 'bend' in the mesh. Thus the question arises: " So is there a way to reduce or eliminate the texture distortion when using TexMesh? ". However, before that question can be addressed, first we need to answer the question: " How exactly does the TexMesh feature work? ".


The first idea that pops into one's head is that the answer is quite straight forward: based on the entered mesh data block's texture space, the texture is 'mapped' over to the 'active' mesh's texture space based on the corresponding vertices.

So let's put this theory to the test. First, add a single face mesh Plane and then duplicate it and apply 'TexMesh' using the techniques as described in the first part. Though this time we'll use a 'Wood rings' procedural texture instead so that we can see how the texture is affected over the entire texture space. After setting up TexMesh, select the top left vertex and move it up 2 grid spaces (effectively scaling the left side of the mesh Plane by a factor of 2). According to the theory, we should see the texture scaled by a factor of 200% at the left edge and then vary to a factor of 0% (unchanged) at the right edge.

Figure 5. TexMesh Results.


Hmmm, very interesting. As you can see above in Figure 5, the texture is being interpolated, as we earlier theorized, but instead of being interpolated across the entire Quad(rilateral) Face, it is being interpolated seperately for each of the two tri(angular) faces that form the quad face. Let's subdivide the mesh planes once, and then slightly adjust the vertices in the active Plane mesh just to be sure. As you can see below in Figure 6, on the lower left modified mesh Plane, there is a noticeable "discontinuity" in the texture in the top two faces where the texture has been interpolated on the basis of each individual triangular face. Note: I have converted the lower right mesh Plane's faces to triangles by using the 'Ctrl_t' hotkey to make it easier to visualize how the edges are orientated. Notice how the texture for the lower triangle in the top right quad face has not been modified at all, which is to be expected as this triangular face has not been modified.

Figure 6. TexMesh Results.


So what are the implications? Well compare the results shown below in Figure 7. On the modified active mesh Plane shown below on the right side, I have rotated the edges (Ctrl_e) in the top two quad faces. Compare the results to the image on the left, where the edges have not been rotated. Although there is some improvement in this instance, if the "dot" were animated moving upwards, it would cross over into the upper right triangle and we would once again see a "discontinuity" as the texture is interpolated for each triangular face individually. Thus, there is little to be gained from rotating the edges, though it might be usefull for a static image.

Figure 7. Rotating the Edges.


So why would the texture be applied for individual triangular faces and not across the entire quad face? Although I'm not completely sure; perhaps textures are always applied based on triangular faces, and we are only noticing it here in the application of TexMesh due to the distorted texture space. In the example cited for the application of TexMesh, ie. a winding river, the mesh manipulation would tend to produce more of a 'shearing' transformation rather than a drastic expansion or contraction scaling effect. For this "shearing" type of mesh translation, the textured result would not be as noticeable no matter how the "interior" edge is rotated. Also, since the type of texture used for this application would be more random, it may produce a more realistic overall result, as one would expect to see some distortion as material is redirected along the curves of a winding river.

In the case where the Active mesh Plane contains a more drastic expansion or contraction type scaling, it would be beneficial to increase the mesh subdivision so that the texture detail would be more accurately interpreted (since the interpolation is occuring over a smaller portion of the texture space). Compare Frames 4 and 7 of the composited animation result shown below in Figures 8 and 9.

Figure 8. Expansion/Compression Type Mesh Transformation.


Figure 9. Subdivided Mesh Result.





Quick Tips.


* Vertices count should match between the TexMesh texture space 'Source' mesh and the 'Active/modified' mesh.

* Xsort/Hash vertices Sorting - In cases where you assemble your mesh "piecemeal", it may be helpfull to perform an Xsort operation on the vertices. (Though, I've used the 'Spin', 'Screw' operations and have never had to use XSort yet to "straighten out" the vertices). The 'Hash' operation randomizes the vertices sequence, which will basically scramble your vertices order and produces very chaotic results when animated.


Figure 10. Xsort/Hash Mesh Tools.

* Duplicating your 'Active/source' mesh using Shift_d is a good method to ensure that the 'Source' and 'Active/target' mesh vertices will be a perfect match. If you use a Python script to perform any mesh manipulation (ie. to unweld your mesh to create holes or 'slits',etc) ensure that you do so before you duplicate the mesh to prevent vertices bearing no relationship between their source and target counter parts. This is because some scripts will completely replace the mesh that it is used on. This will produce a result similiar to performing a 'Hash' operation on the vertices. Refer to Figure 11 below. If you want to place an obstacle in the middle of your river, for example, be sure to use the Python Script prior to duplicating the mesh or another alternative would be to use two seperate Planes (they can share a common TexMesh 'source' mesh) to obtain something similiar to Figure 12.


Figure 11. Discontiguous Mesh Result.


Figure 12. Obstacle Mesh Result.

Obstacle Animation   DivX AVI format, ~866 kB

* It can be helpfull to apply a temporary texture with a grid-like or wood ring pattern initially to provide a preview on how the final texture you plan to use will be affected. Then you can make adjustments accordingly to obtain a better final result.




Other Applications.


Application 2

Let's explore an application of TexMesh for animating transparent textures in 3D space.

Normally, in most applications involving transparency, TexMesh influenced texture mapping would not be a wise first choice. For things like a smoke trail in a Wind Tunnel, or for most other instances of a liquid or gaseous type animation, using a particle effect with the new particle deflection system, or a lattice would be a better choice. When using particles, you can obtain a much more realistic effect, because particles allow you to obtain a volumetric-like effect; ie. the texture "fills" the 3D space. When using Texmesh and a transparent type texture, the texture is not truly volumetric and only affects the surface of the mesh geometry that it comes into contact with; ie. if you were to apply a transparent dot on top of a cloud-like texture to a mesh tube, the inside of the tube is an un-textured hollow void. Also, where the texture is opaque on the surface of the mesh, you would see a clear outline of the mesh tube which also destroys the effect of an unrestricted 3D type cloud.

Instances where controlling the deformation of the texture space using TexMesh might be better suited include the animation of perhaps more "solid-like" forms such as a burning fuse, a slab of hot steel coming out of the furnace, or perhaps an opaque liquid streaming through a glass tube.

First, we will begin with a simple, strictly mesh example and then in the next section we'll expand on this technique by utilizing curves to obtain a more elaborate final result.

OK, let's get started by saving anything you may have been working on, re-initializing Blender and deleting that pesky Cube.

In front view, add a 16 vertices mesh circle and move it 2 grid spaces to the right. Scale the mesh circle down by a factor of 0.2 . Select the top and bottom vertices, duplicate them and then move them 1 grid to the left. Press 'f' to make an edge between the 2 vertices and then scale them by a factor of 4. (The length of this line segment will control the offset of the spring coil's loops we're about to create). Select all of the vertices. You should have the following setup:

Figure 1. Mesh Setup.

In the 'Mesh Tools' panel located in the Edit Buttons window, make the adjustments shown hi-lited in cyan below in Figure 2, and then press the 'Screw' button.

Figure 2. Mesh Tools Panel.

Deselect all of the vertices, and then with your mouse pointer near the center group of vertices (generated by the line segment), press 'l' (l as in link) to select the linked vertices and delete them.

Figure 3. Spring shaped Mesh.

To get an idea of the average distance that the individual edge loops are apart in the mesh spring, select a vertex located in the middle of the first edge loop to the right of the Y axis (as viewed from Top view) and note the X parameter: 0.518 .

Figure 4. Average Ring Loop Seperation.

Enter this value (0.518) into the 'Offset:' numeric input field for the ExtrudeDup offset value. Also set the ExtrudeDup 'Steps' value to 48 (ie. 2 turns at a resolution of 24).

Figure 5. ExtrudeDup Offset.

Select and duplicate the first ring of vertices at the bottom of the spring. In top view rotate the selected vertices 90 degrees and move them 5 grid spaces "above' the spring and position them as shown below in Figure 6.

Figure 6. Tube Ring ExtrudeDup.

Switch to side view and press 'ExtrudeDup'. The straight (rather long) tube generated will serve as our source mesh's texture space which will be utilized in the 'TexMesh' field for the 'Active/target' mesh spring. Usually after performing an extrude operation, some normals can become flipped, so to correct this, select all vertices and press Ctrl_n. Also, in the 'Link and Materials' panel located in the Edit Buttons window, press 'Set Smooth'. In the Material Buttons window, assign the material 'Material' to both meshes. Deselect all vertices and link select just the tube vertices and seperate them by pressing 'p'. Also, you should compare the vertices count of the two mesh objects to ensure that the Vertices/Face count is equal.


Figure 7. Comparing the Vertices Count.

To help keep things straight, name the spring shaped mesh object 'spring' and the tube shaped mesh object (as well as the mesh data block) 'tube' as shown below in Figure 8a and b.

Figures 8a. and b. Naming the Mesh Objects.

In the Texture panel, located in the Texture Buttons window [F6], select 'Blend' from the Texture Type drop down selector. We'll use the default 'Lin'ear progression type to produce a more subtle change in the alpha property, but we'll also need to make the transition region a little more drastic so that the transparency transition occurs over a shorter part of the tube, and not the entire tube length. (You can use 'Quad'ratic/square root Blend type if you prefer an even sharper transition). The black portion of the Blend procedural texture will be the transparent part of the texture and the white part will be opaque. Though this is easily reversible by either pressing the 'Neg' button or pressing the 'Alpha' button a second time (such that the 'Alpha' text is a yellow color to indicate a reversed state). Both of these controls are located in the 'Map To' panel located in the Material buttons window shown below in Figure 10.

(Note: We could have also used a simple half Black/ half White image as a transparency/Alpha mask. If you chose to use an image, be sure to un-set the 'MipMap' button in the 'Image' panel that will appear to prevent the feature from attempting to anti-aliasise the simple two color texture; which will produce several shades of gray; which in turn will make your mesh appear faceted when rendered, despite having applied 'Set Smooth'). For more information with regards to MipMap refer to: Answers.com - mipmap

Figure 9. Blend Texture.

To create a sharper transition, switch to the Material buttons window and in the 'Map In' panel, increase sizeX to 10.0 (or higher for a sharper transition, if you prefer). Also, adjust the texture color to medium orange and reduce the Spec to 0.2 . To keep the current material property similiar to the 'blend' procedural texture (and as a reminder Black = transparent), set the Material color to black in the Material panel (Note: Material panel is collapsed below in Figure 10)

Figure 10. Material Settings.

Select the 'spring' mesh, and switch to the Edit Buttons Window [F9]. In the 'TexMesh' text entry field located in the 'Mesh' panel, type in the name of the Mesh data block that will be used as the source for the texture space: 'tube'.

Figure 11. Setting the TexMesh Source Mesh.



Switch to Shaded view mode by pressing Shift_z or by selecting the icon from the 3DWindow header displayed below in Figure 12. You will notice that the scene is rather dark. This is because Shaded mode depends on the scene's lamps for illumination. So add a number of Lamps in the Scene to illuminate the spring and tube meshes.

(* Important Note: The information presented here with regards to viewing the animated texture in Shaded mode, is presented strictly for the purpose of illustration for this tutorial. Once you understand how texture space and TexMesh works, it isn't a necessary part of obtaining the final result. Though it can serve as a powerful troubleshooting aid, should you run into problems or get unexpected results).


Figure 12. Shaded View Mode and Lamp Setup.


Now to create an animated Alpha/transparency texture.

Select the tube mesh and align your view so that you can easily view the entire length of the tube mesh. What we want to have happen, is the entire tube starts out opaque (Orange) and at the end of the animation 100 Frames later, becomes completely transparent (Black).

Split the 3DWindow vertically and change the right side window to an IPO Curve Editor window. Change the IPO curve type in the IPO Curve Window header from 'Object' to 'Material'. From the channel list on the right side, select 'OfsX' using LMB.

(Note: the Y Axis for OfsX is in units of Texture Space NOT Blender Grid Units).

(Note #2: Texture Space is NOT the same for Procedural Textures and Images - For Procedural Textures, Texture Space extends from -1 to 1 ; For Images, Texture Space extends from 0 to 1).

Now our transition point (with no X Offset applied, ie. ofsX = 0, is sitting in the middle of texture space half way between -1 and 1 = 0, which would be the midpoint of our animation (Frame 50), as you can see above in Figure 12. At the start of the animation (Frame = 1) to get the tube completely orange, we need to slide texture space in the positive X direction one-half the breadth of texutre space from the initial position; therefore, X offset would equal 1.0 .

You might be wondering "Why a positive X offset, that seems to be the opposite direction of what it should be?" The reason for this is that, it is the Texture Space that is being offset, not the texture. As an analogy, imagine you have a picture and a picture frame. The picture is the texture and the picture frame represents Texture Space. Look at Figure 12 and imagine the Black/Orange tube to be our picture, you would need to offset the picture frame in the positive X direction (ie. to the right), so the image in the frame starts with the orange color. I hope that's clear.

The second point will be the inverse of the first point = -1 . In terms of our analogy, the picture frame (texture space) is slid one unit to the left. We may need to adjust these values slightly due to the small transition region in the middle, so that the tube is completely orange (opaque) at the start of the animation, and completely black (transparent) at the end.

Add two curve points by Ctrl_LMB clicking on the 3Dgraph portion of the IPO Curve window. For the first point, click near the co-ordinates X = 1, Y = 1; and for the second point: X = 100, Y = -1 . Then press 'n' and ensure that the exact values for the two curve points are entered.

Press 't' and make the curve type 'Linear' from the popup menu that appears.


Figure 13. OfsX IPO Curve.


The next step is to tweak the OfsX IPO curve, so that the mesh is completely Orange at Frame 1 (Opaque), and completely Black (Transparent) at Frame 100.

To make it quicker to navigate from the first to last frame using the shortcut keys Shift+Left Arrow Key and Shift+Right Arrow Key, set the End Frame in the Anim panel in the Display Buttons Window to 100.

Unfortunately, in Blender version 2.37a, the texture is not automatically updated for Shaded view mode in the 3dWindow based on a change in the OfsX IPO curve (or any IPO curve, for that matter). Hopefully, this feature will be added in the next release.

For now, to actually see what is happening with the texture in the 3DWindow, we need to force it to update using one of the following methods:

- with your mouse pointer in the 3DWindow, press Shift_Alt_z, or

- activate a move operation on the tube mesh and then cancel the operation with a RMB click or by pressing Escape, or

- change (ie. bump it temporarily) almost any Material property in the buttons window, ie. : Material color, sizeX, etc.


To achieve the results shown below in Figures 14 to 18, I found that I had to adjust the curve points slightly to:

first curve point:       X = 1,   Y = 1.1

second curve point: X = 100, Y = -1.1




Figure 14 - 18. Adjusting OfsX IPO Curve.



Move 'm' the tube mesh and it's associated lighting to a different layer.


Figure 19. Moving Unnecessary Scene Elements.



Select the spring mesh, and in it's Material properties in the 'Map To' panel switch off 'Col' and press the 'Alpha' button. In the 'Material' panel, set the material color to orange, and slide the Alpha 'A' slider to 0.0 .

(Note: Although it's not necessary in this example, where the transparent material always appears "behind" the opaque material, if the order was reversed, the result would not render correctly. In any event, it would be a good idea to press the 'ZTransp' button in the 'Mirror Transp'arency panel and also reduce 'Specular Transparency' to 0 since we want the transparent part of the texture to be completely invisible - as shown below in Figure 20).

Figure 20. Adjusting Final Material Properties.



Set up the camera to properly display the spring mesh.

Render Settings Check List (Display Buttons window):

Output panel: Set Animation path and name
Render panel: Set OSA and OSA level (if so desired),
Anim panel: Ensure Start/End Frame are set properly (1 and 100) - should be set already, and
Format panel: File Format selector set to 'AVI Raw'.


Press 'ANIM'.

Figure 21. Display Buttons Window Settings.



Figure 22. Animated Transparency Texture.


TexMesh Alpha Animation   DivX AVI format, ~46 kB





Application 2B

This section expands on the technique presented in the previous section by utilizing curves initially to obtain a more elaborate final object to which we will be applying an animated transparency texture. Using curves makes this technique ideal for creating a burning fuse animation, since we can re-use the original curve used to form the tube shaped object as a path for an emitter mesh to add sparks and a smoke trail to simulate the burning fuse end. Also, the emitter will cover up the open end of the tube giving the impression that the fuse wire is a solid object. Since the other end of the fuse would go into the fireworks (or anything else that the fuse is connected to), the other open end will also be concealed.

On a piece of paper, sketch out the curve you wish to make and calculate how many curve points will be necessary to create that shape. For the curve that I have in mind, we will need 20 control points, (or 20 * 3 = 60 if you include the control handle vertices).


Figure 1. Curve.

In top view add a Bezier curve. Move the right curve point one grid unit to the right, and then move all of the curve points close to a grid intersection so that it approximates a straight line. Snap the selected vertices to the grid. In the Edit Buttons Window - Curve Tools panel, below the 'Convert' text, press the 'Poly' button, to convert the curve to a poly line in order to make it easier to work with. Select one end point and extrude until you have 5 points to one side of the origin. Repeat for the other side. You should now have 11 points. Select all and subdivide to produce 21 points. Scale the points by a factor of 2.0, so that each point is one grid spacing apart. Since we have one more point than we need, delete one off the end.


Figure 2. Curve Setup.

Use the 'Convert' set of buttons once again to convert the Poly Line back to a 'Bezier' curve. All of the handles will initially be 'Vector' type (Green).
To make the curve 3D, press the '3D' button in the 'Curve and Surface' panel (Edit Buttons window).

Figure 3. 3D Curve Button.


Tab out of edit mode, duplicate the Bezier curve, and move it 10 grid units up (+Y direction).

Tip: In order to keep the duplicated curve (plus the camera and lamp) from getting in the way, move these items to an unused layer.

Reselect the original Bezier curve and tab back into edit mode.
Use Table 1 below as a guide line for placing and changing each individual curve handle type.

Note: the table uses a 'short hand' notation for the Handle types:

G = Green = Vector handles, Hot Key:   v

B = Black = Free handles, Hot Key:     h (toggles between Free and Aligned)

P = Pink = Aligned handles, Hot Key:   h (toggles between Free and Aligned)

Y = Yellow = Auto handles, Hot Key:   Shift_h


The 'Location' column is in the form X, Y, Z. Unless otherwise noted, Z = 0 for the curve point.

Tips:

- First place the curve points and then change the Handle type.

- To make it easier to place the Curve points (especially for the looping portion of the curve), move the bulk of them off to the right side and move them back one at a time. Be carefull to select the main curve point and not just a handle, as the handles will stretch a bit when you offset them. ie. you should see 3 curve points hi-lited in yellow if you've selected the right one.

- Remember that the main curve points were snapped to the grid lines, so you can easily move them by holding down Ctrl for whole unit translations and Ctrl_Shift for decimal (0.1) translations. Also, keep a Numeric Transform Properties 'panel' open (ie. press 'n'). This will allow you to see the absolute control point location versus the relative translation value that appears in the 3DWindow header.


Table 1: Curve Control Vertices
Vertex Number Location Curve Handle Type Vertex Number Location Curve Handle Type
1 -9, 0 G 11 4.5, 0 P
2 -5, 0 G/P 12 5.3, 2 Y
3 -4, 0, 1 P 13 6, 0 P
4 -3, 0 P 14 6.7, -1.5 Y
5 -2, 0 P 15 7.5, 0 P
6 0, -3 Y 16 8, 1 Y
7 3, 0 Y 17 8.5, 0 P
8 0, 3 Y 18 9, -0.8 Y
9 -4, 0 Y 19 9.5, 0 P/G
10 0, -5 Y 20 10, 0 G

Note: the values in the above table are only meant to be used as a starting point. You will need to slide and rotate the curve points/handles around a bit and also change some curve handle types in order to obtain as smooth a curve as possible. Also, you may need to toggle between Free and Aligned curve handles in some places to get the desired final shape. Finally, it can be hard to judge the true shape of the curve or spot small 'misalignments' in edit mode, so check the curve in object mode once in a while during your editing session and also rotate your view so you can see what the curve looks like when viewed from different angles.


Figure 4. Vector Curve Point Placement.


Figure 5. Setting Curve Handle Type.


Figure 6. Final Curve Adjustments.


At this point of the tutorial, we have to make a decision. We could add a profile curve and then use the 'BevOb' feature to create the tube-shaped curve. In most cases, where you are creating a long tube, this works perfectly because it automatically increases the curve resolution in regions where there is a sharp change in the curvature of the curve and reduces the resolution in long sweeping portions of the curve. Unfortunately, in this instance, where we intend to use the result with TexMesh, this leads to a more highly compressed mesh at some points in the curve, and also more "spread out" mesh loops at other points in the curve (After the curve is converted to a mesh). Refer to Figure 7 below. This, in turn, causes the curve's transparency animation to speed up and slow down at various points on the curve, since we are animating texture space in a linear fashion across evenly spaced mesh vertices in the 'Source' Mesh relative to the unevenly spaced mesh vertices in the 'Active' curve/tube mesh. Refer to the animation below to view the results of using this method.

Figure 7. Unevenly spaced Mesh Loops.


Transparency Texture Animation using BevOb.   DivX AVI format, ~42 kB


To avoid this pitfall of using 'BevOb' in combination with TexMesh, we will instead use the DupliFrame technique combined with a Surface NURBs circle profile curve, which will allow us to evenly space the resulting mesh loops and control the spacing of those loops.

In top view, Add a Surface > NURBS Circle and scale it down by a factor of 0.1 .
(Note: To make it easier to see what is happening, I used a scale factor of 0.2 for the images in this section).


Figure 8. Adding a Surface NURBS Circle.

Parent it to the Curve using the 'Normal Parent' option from the popup menu. Without changing the selection setup from the previous Parenting operation, (ie. Profile NURBS circle is selected - dark violet color, curve is the active object - a light violet color), activate 'Curve Path' and 'Curve Follow' in the 'Curve and Surface' panel (Edit Buttons window). You should see the NURBs circle object snap close to the start of the curve.


Figure 9. Setting up a Curve Path.

RMB select the NURBs circle object. To align the NURBS circle's "opening" to the curve path, activate the Draw Axis option in the 'Draw' panel (Object buttons window). In the 'Anim settings' panel, set the 'Track to' and 'Up Axis' so that it is properly orientated with respect to the curve path. Turn off the Draw Axis option. Also, switch on the 'No Speed' option in order to save us a bit of time setting up a Path Speed IPO curve.


Figure 10. Adjusting the Curve Orientation to the Curve Path.

With the NURBs profile circle selected, activate the DupliFrames feature in the 'Anim settings' panel. The resulting Dupliframed results are a little too "spread out" to form a good shape at the sharper parts of the curve, so increase the DupEnd setting to 250.

Figure 11. DupliFrames.

You won't notice a change because the path length also needs to be set to 250. To adjust this, select the path, and in the 'Curve and Surface' panel, increase 'PathLen' to 250.

Figure 12. Setting the 'PathLen'gth.

(Note: You should take a look at the Dupliframed objects along the length of the path to make sure that they are not "clipping" or overlapping one another; specifically at places in the path where there are sharp curves. If this is the case, you will need to edit the path curve to correct this, or reduce the radius of the profile curve, if you prefer).

Select the Dupliframed object, and press Ctrl_Shift_a to make all the DupliFramed objects "real".

Figure 13. Making the DupliFramed Objects Real.

Switch to front view and move the selected objects away from the path about 5 Grid units in the -Z direction (Be sure to hold down Ctrl when you do this). Select the first profile curve used to create all the dupliframed curves. You can spot when you have selected the right one, because the dashed line emanating from it back to where it is still parented to the path will be hi-lited in pink. If you don't select the right one at first, simply right click again at the same spot until you have the right one. Blender will succesively tunnel through objects that are lying on top of one another. Once you have selected the original curve, move it back to the path.

Figure 14. Isolating the Original Profile Curve from the DupliFrames.

To seperate it from the rest, in the 'Link and Materials' panel, click on the number (should be 251) and confirm the make 'Single user' prompt.

Figure 15. Seperating the Original Curve so that it no longer shares the same Curve Data.

Deselect all, RMB select the first Dupliframed object on the left, and then box select all the 250 individual curves forming the tube shape. Press Ctrl_J to join them into a single object.

Figure 16. Joining all the DupliFramed Curves into a Single Object.

Tab into edit mode and press 'f' to surface the tube. Zoom in and press 'z' to enter Solid view mode. In some instances where the orientation of the object being dupliframed has been reversed, you may see that the outside of the tube is black, instead of the proper gray color. If this is the case, I would recommend deleting the tube and then readjusting the 'Track' and/or the 'Up Axis' control and then repeating the steps up to this point. It is possible to reverse the curve direction by pressing 'w' - 'Switch Direction' to turn it right side (gray) out instead, but I found that this causes problems later on during the texture animation stage. Plus, most of the controls are already properly set, so it doesn't take much time to recreate it.

Figure 17. 'Skinned' Nurbs Surface.

In the Edit Buttons Window / 'Curve Tools' panel adjust the NURBs "curve"'s resolution parameter 'Resol U' to 250.

Note: In Blender versions 2.36 and earlier, ResolU was limited to a maximum value of 128, which will cause the 250 DupliFramed "loops" to be truncated to 128 when converted to mesh (in order to use 'TexMesh'). So if you haven't already done so, I would recommend that you upgrade to Blender version 2.37a .

Figure 18. Adjusting Resol U.

If you look closely at Figure 17 above, you will notice that in the Information Window, the vertices count does not reflect the resolution adjustment which was just made, but instead displays the original NURBs circle loop of the 8 'vertices' selected and since we made a total of 250 copies, 8 * 250 = a total of 2000 'vertices'. However, the vertices count after the conversion is made to mesh will be based on the 'Resol U' and 'Resol V' settings.


Prior to converting the curve to a mesh it would be a good idea to save your work, as Blender does not allow you to convert back to a curve from a mesh object. Alternatively, you could also just duplicate the curve object (In object mode) and move it to an unused layer.

Tab out of edit mode and convert the curve to a Mesh using Alt_c.

Figure 19. Converting to Mesh.

If you check the vertices count, you should see that the vertices count for the mesh (as defined by the previous curve's 'Resol U' and Resol V' settings is equal to 3000 ( 250 mesh loops * 12 vertices per mesh loop ). Exit edit mode and press 'Set Smooth' for the mesh tube.

Figure 20. Vertices Check.

Now we need to create an identical vertices count 'straight' mesh tube, which will serve as our 'Source' texture space mesh.

First move the curved tube, path and profile curve to an unused layer, and move the 'straight' curve that we duplicated at the beginning of this section to layer 1. Move the 'straight' tube 10 units in the -Y direction, so that it is located once again at the origin.
In top view mode, add a Surface NURBS Circle, scale it down 0.1 and parent it to the straight path using the 'Normal Parent' option. Activate 'Curve Path' and 'Curve Follow' options to make the curve a path. Repeat the identical DupliFrame procedure we went through before when we created the 'Active'/curved mesh tube to obtain a straight mesh tube.

Note: In some instances, you may find that the straight NURBs tube will come out inverted (ie. black on the outside and gray on the inside); despite the fact that we used an identical curve and alignment for the first setup. If this is the case, I would simply leave it as is, and after setting 'Resol U' = 250 and 'Resol V' = 12, convert to mesh. Then recalculate the normals outside (Ctrl_n). Also, in this case, you will find that after applying the material, the material is reversed, ie. in Figure 23 below, the blue and orange materials are opposite to one another for the two tubes. To correct this, simply rotate the straight mesh tube 180 degrees in edit mode and while in top view mode.

In Edit mode, check the number of vertices, it should be identical to the 'Active'/curved mesh tube: 3000.
Select the path and the profile curve and move them to an unused layer.
Press 'Set Smooth' for the 'straight' tube and then exit out of edit mode. Offset the straight tube in the +Y direction 10 grid units. Move the 'Active'/curved tube back to Layer 1.


Figure 21. Vertices Check.


Select the mesh tube and move it back to the origin (5 grid units +Z). Activate the 'Draw Axis' for the two mesh tubes. To realign the mesh tubes axis with the global axis press Ctrl_a (Apply Size and Rotation) for each tube. Turn off the 'Draw Axis' option.

Figure 22. Realigning the Mesh Axis.


From this point forward, we use the exact same procedure used in the previous section to create the animated transparency.   Briefly:

- Ensure both Mesh objects are sharing the same material,

- Enter the name of the 'Source' mesh into the 'Texmesh' field of the 'Active' mesh (Ensure you enter the proper Mesh Data block name),

- Add an Alpha Map texture (either a procedural blend, or an Alpha Mask image texture),

- Animate the Alpha Map texture using an Offset IPO curve,

- Ensure any unnecessary objects not required for the final render are moved to an unused layer,

- Set up the Camera and lighting,

- Set up the Display Button Window options ,

- Save your work (if you haven't already done so), and

- Render the final animation.


Figure 23. Shaded View Mode Check.



Fuse.


TexMesh Alpha/Fuse Animation   DivX AVI format, ~1.1 MB





Application 3

Warping 3D procedural Textures to conform to the geometry of an object





Application 4

Creating Stylized Wave Patterns


In this section, we will break the rules of physics by dropping a heart-shaped rock into a pool of water, and have it generate a series of heart-shaped waves.

A disadvantage of this technique is that it is only applicable for creating a primary wave; ie. - it is not well suited to generating secondary waves as in the instance of where a "crown-shaped upswell" produces droplets which in turn generate an additional set of waves that interact with the primary wave.
Of course, with the upcoming fluid dynamics in Blender 2.4 , this technique will most likely be rendered obsolete.

Step 1: Set up the necessary Mesh Geometry.


4.1. Delete all vertices, except for a single vertex from the default cube. Snap the remaining vertex to the cursor.

Switch to the Edit Buttons Window [F9]. In the 'Mesh Tools' panel adjust the 'Steps:'setting to 31. Change the 'Offset:' setting to a value of 0.1 .
Switch to the Left Hand Side view [Ctrl_NumPad 3] and press the 'Extrude Dup' button.

Switch to top view. Increase the 'Degr'ee: setting to 360. Also, increase the 'Steps:' setting to 64, ensure all vertices are selected and press the 'Spin' button.

Note: Do Not remove the duplicate vertices.

You should now have a relatively high 2,080 (32 * 65) vertices count concentric circle shaped object as shown below in Figure 4.1 .

Figure 4.1. Circular Mesh.

4.2. Select the outermost rim of vertices and hide 'h' them.

Tip: Use 'select Non-Manifold mesh', Ctrl_Alt_Shift_m to select the outer rim of vertices, and then manually de-select the vertices which were selected on the inner over-lapping part of the mesh.

Using the Proportional Edit Tool, shape the remaining vertices to form a heart shape.

Tip: Hide the lower half of the vertices in the circular shape, then vertex loop select (Alt_b) the center line of vertices and (using smooth fall off), scale them to the cursor in the center. Then hide the top vertices, select the lower middle line of the lower group of vertices and scale out from the center cursor. (using sharp fall off mode).

Unhide the hidden vertices 'Alt_h', and scale and move the outer circle to encompass the heart. Select the second outer most loop of vertices using vertex loop select (Alt_b).

Note: The vertex loop select hotkey (Alt_b) is being 're-allocated' to serve a different purpose in the next Blender version, so you may want to get use to using the alternative vertex loop selection method: Alt_RMB click an edge running in the direction you wish to perform the vertex loop selection. (This also works for the current Blender version 2.37a).

Figure 4.2. Tweaking the Mesh.


4.3. Using the 'To Sphere' feature, adjust a few of the outer loops of vertices to form a smoother transition to a circle.

Figure 4.3. Tweaking the Mesh.


4.4. Create a new grid-like mesh object that matches the vertices count of the circular mesh object to serve as the source mesh (32 * 65 = 2080 vertices). Place a vertex at the origin and from the front view, 'Extrude Dup' (Ensure that the 'Offset:' setting is still set at 0.1) using a 'Steps:' setting of 31. Then from the side view, increase the 'Steps:' setting to 64 and 'Extrude Dup' again.

Note: Be sure to recalculate the normals outside, Ctrl_n for the two mesh objects.

Figure 4.4. Creating the Source Mesh.


Step 2: Assigning a Material and Animated Textures.
4.5. Assign a single user material and texture to the two meshes.


First a little background information about Blender's Displacement mapping:


Blender's Displacement Mapping uses a gray scale image to perform a true displacement of the vertices.
The gray scale image ranges from black through the various shades of gray to white. In terms of values:

White = Maximum positive, R = G = B = 1 (100%), value = 255;
Medium Gray = Zero, R = G = B = 0.5 (50%), value = 128;
Black = Maximum Negative, R = G = B = 0 (0%), value = 0.


Depending how these gray scale images are combined when using Displacement mapping will determine the final outcome.
For instance, if you have the texture blending mode (located in the 'Map To' panel) set to 'Mul'tiply; white (1) 'Mul'tiplied by any of the other gray scale values acts as an Identity quantity and returns the gray scale value it was multiplied by; 50% medium gray will always return zero, and black will return the inverse of whatever shade of gray and white it is 'Mul'tiplied with to a maximum minimum ;) of -1 (ie. black or a Maximum Negative displacement value).


By using the various mapping modes, ie. 'Mul'tiply, Add, etc, you can achieve some pretty interesting effects.
Though for this example, we will only make use of the 'Mul'tiply mode.

For the first texture channel load an image texture with alternating horizontal gray-to-white / gray-to-black scale lines to serve as a displacement map. The texture I used is shown below in figure 4.5a. The top gray portion of the texture serves to keep the water surface at zero, until the stone dropped makes contact. Notice that the texture is "cropped" by adjusting the MinY setting to 0.6 .

Figure 4.5a. Wave Displacement Map.


Figure 4.5a2. Wave Texture Settings.


Figure 4.5a3. Wave MapTo Settings.


Figure 4.5a4. Wave IPO OfsY Curve Settings.


For the second texture channel load an image texture that starts with white, then makes a white-to-gray transition, culminating in pure gray strip at the top. The purpose of this texture is to cause the waves to subside, as the waves move outwards from the origin of the stones impact with the water surface to the outermost portions of the wave travel. Notice that this texture is also "cropped" so that the waves are unaffected at first (white) and then slowly cause the waves to subside (white transition to gray) until the waves completely disappear (medium gray = 0).

Figure 4.5b. Subside Displacement Map.


Figure 4.5b2. Subside Texture Settings.


Figure 4.5b3. Subside MapTo Settings.


Figure 4.5b4. Subside IPO OfsY Curve Settings.


Step 3: Setup TexMesh.

Enter the Mesh name of the grid into the TexMesh field for the heart/circular shaped mesh.

Try a few test renders. You will likely find that you need to tweak the displacement texture properties to obtain a good result.

Figure 4.6. Heart Wave.

Heart Wave Animation   DivX AVI format, ~2.2 MB