3D tutorials, tips and techniques, inspiration and community.

Monday, December 15, 2014

Estelades and Progressive Refine in Cycles

For a while now, I've been wanting to create an image that would showcase some fun, alternative designs of the Catalan pro-independence flag—known as estelada. The image I came up with is pretending to be a natural-history museum kind of display of lapel pins typically worn by pro-indy folks—although this practice used to be more common back in the seventies than it is nowadays. I was inspired by a friend's piece of individual cereal bits displayed in a similar manner.

Coincidentally, while I was rendering this piece, I noticed something funny going on with the Progressive Refine mode. I have this app, called iStat Menus, to control CPU usage and temperature, and adjust fan speed accordingly. Anyway, I noticed a cyclical fluctuation in CPU usage and temperatures when using the Progressive Refine render option. The final image had a resolution of 1500x1200 pixels, and since I do not own a super-duper computer, this is quite a large scene for me to render. The cyclical fluctuation was happening coinciding with each sample being rendered. During rendering, CPU usage would shoot up, and the CPU would slow down in between samples. This rendering mode, I think now, is a good choice for those who are worried about burning out their CPU during rendering. Good find :)

Friday, November 28, 2014

Controlling Texture Tiling in Cycles

A couple of years ago, I wrote a small tutorial on how to apply one or more textures as decals to one single mesh in Cycles. The technique back then took advantage of using several UV maps fed through the Attribute node. Today, I am revisiting this topic because it is perfectly possible to apply one or more images to mesh in Cycles with total control over scale, rotation, position—and more importantly, tiling. Let's see how this is done.

Open up a new Blender file, get rid of everything, and add a plane. Press 7 to switch to top view and Shift-C to center the view on the plane. I like to work on Orthogonal view, but that's me. Create a material for the plane. Split the window to have access to the Node Editor. In the 3D Viewport, switch to Rendered shading mode. Now, with the plane selected, go into Edit mode, select all, and press U to UV unwrap the plane with the option Project from View (bounds).

Now, make sure you have the Node Wrangler addon activated. In the Node Editor window's Properties panel, click on the Add Texture Setup button. This adds a Texture Coordinate, Mapping, and Image Texture nodes and connects them to the existing Diffuse node (Figure 1).

Figure 1
Now you need to choose an image texture in the Image Texture node. I am using a free image of an earth I found on Pixabay. The image I used is a PNG with a transparent background (Figure 2).

Figure 2

Now, I'd like to scale this image down to 25% and place one single instance of it—that is, without tiling it. However, when you change the scale in the Mapping node, the image becomes tiled! This is not what we want. Notice I am using the Point option in the Mapping node, which alters the projection itself, not the texture. To scale down the image to 25% size, you need to enter a 4 (Figure 3).

Figure 3

So, how do we stop the image from tiling? It took me a while to discover, but you do it by checking the Min and Max options, and entering the appropriate values. What does Min and Max mean? Min and Max control how a texture tiles over the XYZ axes, so the Min and Max value refer to dimension units in the texture coordinate. Check these two options and see what happens! The image texture stops tiling at the maximum coordinate value assigned under Max—which is one, so the tiling stops at 1 (Figure 4). If you enter non-integer values here, you'll get a bit of a tiling stretching over the remaining geometry in that axis. Blender simply extends the pixels at the texture's edge (Figure 5).

Figure 4
Figure 5
I'd like to scale the earth to 50% its original size, and place it in the center. There are several ways to do this with the mapping node. I find that using a 2 scale in Point mode, and changing the X and Y location to -0.5, as seen in Figure 6, works well enough.

Figure 6

OK, so we can stop an image texture from tiling over the whole UV projected mesh. This is actually great news for decal professionals in Blender. What about adding a second image texture to the same mesh without using a second UV map? Piece of cake. Image 7 shows the noodle I am using. I am simply using a different Mapping node for the second image (the moon). For this example, I am mixing the two textures with the Add mode. Also, it is important to combine colors of different image textures before plugging the color info into a shader node. Combining color info at the shader level becomes more restrictive, because we lack certain mixing modes for shaders.

Figure 7

Let's take this one step further. I want the plane to be dark blue, and I want to place the earth and the moon on top of it as if they were bumper stickers. For this, I will use the alpha information from the texture images themselves, I will combine them into one grayscale image, and this will control the mix between two shaders—one with the earth and moon, the other, dark blue. Image 8 shows the final node setup.

Figure 8
Figure 9

Wednesday, November 26, 2014

Aligning Geometry to World Axes in Blender

Oftentimes, I have been puzzled by Blender's apparent lack of capabilities regarding work planes (this is not entirely true—see Update at the bottom of the page). A work plane, as defined in other programs such as modo, lets us change alignment of the global XYZ axes momentarily in order to edit a mesh in a more comfortable way. In this post I am sharing my own workaround in Blender to align any object to any work plane, with one condition—the work plane needs to be represented by some mesh element. An example will make this more clear.

Open up a new Blender file and delete everything. Press 5 to go into Orthogonal view. Add a Sphere. Now, go into Edit mode, switch to Face mode, and select a random face (Figure 1). We will realign the whole sphere so this face ends up squarely aligned to the world axes.

Figure 1
Blender has a set of view alignment commands that align the view to any selection within a mesh. The alignment can be to the top, bottom, front, back, right, and left of a selection (Figure 2). The keyboard shortcuts for these alignment commands are the same as the ones used for standard views, but with the Shift key added. So, if Numpad 7 is used to switch to top view, Shift-Numpad 7 is used to align the view to the top of a selection. Press Shift-Numpad 7 now to align the 3D Viewport to the top of the selected polygon (Figure 3). Press Shift-S and choose Cursor to Selected to place the 3D cursor on the selected face.

Figure 2
Figure 3
Press Tab to go into Object mode. Making sure not to change the 3D View, press Shift-A to add a Cube. In the Tool Shelf options for the newly created cube, enter 0.1 for Radius, and check the Align to View option (Figure 4). The cube is placed exactly in the precise location where the selected face sits. You can rotate the view to check this is so (Figure 5).

Figure 4
Figure 5
If you check the cube's Transform values in the Properties panel, you'll see it has the same location and rotation as the selected face (Figure 6).

Figure 6
Now, deselect everything. Select the sphere and then the cube. Press Control-J to join them into one mesh. The selection order is important, because we are joining the sphere to the cube, not the other way around. This way, we are preserving the cube's funky rotation and position. All you need to do now is press Option-G and Option-R to clear the object's rotation and location. The sphere-cum-cube is aligned perfectly so that the selected face is facing squarely up in the Z axis (Figure 7). 

Figure 7
Finally, go into Edit mode, select the cube, and delete it. Go back into Object mode, press Shift-Control-Option-C, choose Origin to Center of Mass, and press Option-G again to clear its position and place it on the world origin (Figure 8). We are done!

Figure 8
Update: Right after I published this post, Eriandor left a comment with  a link on creating custom transform orientations. I did not know, or remember, this feature existed. I think now custom transform orientations might offer a better, less cumbersome workflow in many cases. Thanks Eriandor! Here is the link.

Thursday, September 25, 2014

Tea Bottle Studio Render

I am showing here a render of a commercial piece I worked on a while ago, with some modifications—the label has been replaced with one of my own invention. For those interested, it reads matcha, the word in Japanese for green tea.

Image 1. Green tea studio shot, with some
condensation drops to add a bit more interest.

Readers of this blog may already know of my predilection for rendering anything glass and liquid. Some examples are here and here. For the tea in the bottle, originally I had used Blender Diplom's absorption node trick. Since the last time I worked on this piece, volume absorption support was added to Cycles, so I changed the setup to the much more straightforward shown on image 1. I will be playing around with volume very soon, it's a great feature for sure :)

Image 2. To add absorption to glass, simply connect a Volume Absorption
node to the Material output Volume socket. It is just awesome! 

As for the scene setup, I am showing here a screenshot of what it looks like. It's nothing too fancy: just a few lights an a studio backdrop. I love how Cycles lets you see the studio setup as a rendered image, it looks awesome!

Image 3. Cycles lets you see exactly what your scene looks like,
even from far away. It's weird, but nice :)

Image 4. Who can read a wireframe, anyway?

Saturday, September 13, 2014

Cycles Workshop near Barcelona

This coming Friday, September 19th, as part of Dia de la llibertat del programari (Software Freedom Day,) organized by the open source advocate group Konfraria, in Palma de Cervelló, Catalonia, I will be teaching a free, two-hour long workshop on creating materials with Cycles.

This workshop is aimed at (non-raw) beginners and intermediate users of Blender, and will be taught in Catalan. I will be covering the fundamentals of Cycles, from a quick semi-technical explanation of what it is (an unbiased ray tracer) and what it can do (awesome stuff!) to a quick overview of its main features, such as its nodal workflow, render settings, and compositing-friendly capabilities. I encourage all attendees to bring their own laptops in order to better follow all the steps, and reproduce the results. I recommend that all attendees have the latest version of Blender installed, and strongly urge that you install the Node Wrangler (Node Efficiency Tools) add-on. Although, starting with the 2.71 version, it comes with Blender by default, just in case, here is the link to download it.

After a quick overview, I will talk about what a material is in the 3D rendering world, and how to approach the creation of materials so that they do what we need them to do, considering matters of time constrictions, production, in addition to subjective considerations.

The third part of the workshop will center around the creation of some of the basic materials. We will be going over how to create a basic mix shader, and how to use the Factor socket. After that, we will cover two-sided materials, placing decals, reusing and organizing materials, and finally the creation of a complex wood floor material.


Resum del taller

Cycles és, com Blender mateix, una eina en constant evolució, i intentar explicar-lo en un taller de dues hores és pràcticament impossible. Aquí ens concentrarem en aprendre a crear materials bàsics amb Cycles i tenir una idea de com se’n poden generar de més complexos.

Abans de començar seria interessant saber quin nivell de coneixements sobre Cycles i Blender tenen els assistens.

També, parlarem sobre què és un material. Es podria concebre com una interpretació subjectiva de la percepció de la superfície i el volum d’un objecte, de com es reflecteix la llum, i de quines característiques geomètriques en són d’importància.

No existeix cap material “tot terreny”. Els materials s’han de recolzar i depenen de la il·luminació, la geometria de l’objecte, la il·luminació global i els ajustos de renderitzat, entre altres.

Eines utilitzades
-Node Wrangler (Efficiency Tools). Ensenyar el funcionament de Control+Shift+Click (Preview node) i el de Shift+S (Switch node)
-Cycles addon, of course :)

Fonaments de Cycles
Què és Cycles?
Cycles és un unbiased renderer. És el que es diu un ray tracer render engine, generalment oposat a un path tracer, que introdueix un error (bias) que serveix per resoldre el “high frequency noise”. Cycles afecta tot el funcionament de Blender a molts nivells. Entre altres coses, permet treballar amb diferents render passes per compositing, ofereix previsualitzacions a temps real en el 3D viewport, i conté tota una sèrie d'eines específiques pel renderitzat eficient i el control de la càmera i la il·luminació.

Tipus de materials
-Material (Surface, Volume, Displacement)

-La correlació entre un workflow on s'utilitza la interfície principal i el nodal interface.
-Els colors dels sockets (endolls) dels nodes i la seva importància.
-La normalització dels valors (blanc i negre).
-Utilitzem el Viewer node (Control+Shift+Click) per veure quin efecte té el node en qüestió.

Creació de Materials
Barrejar un Glossy amb un Diffuse amb un Layer Weight (Fresnel o Facing) com a factor.

-Materials diferents en cada cara
Com utilitzar el node Geometry per controlar què es veu i què no. Comparar aquest node amb el de Light Path, i amb les funcions de Ray Visibility en l’object tab del Properties panel.

-Col·locar una enganxina en un objecte
La utilització dels UV maps i els nodes necessaris per mapejar una imatge correctament. Nodes utilitzats: Texture Coordinate, Attribute, UV Map, conjuntament amb la creació de UV maps addicionals.

-Reutilitzar els materials
Grups de nodes per organització i reutilització.

-Crear un parquet procedural (exercici difícil)
Mirarem exemples i cadascú que ofereixi la seva solució.

Recursos externs essencials pels que vulguin endinsar-se en la creació de materials amb Cycles.
-Good Textures
-Manual de Blender
-Blender Cookie
-Blender Guru
-Blender Diplom

Thursday, July 31, 2014

New Beginner's Seminar—Creating Materials with Cycles

This coming September 19th, in the town of La Palma de Cervelló (Catalonia), as part of the Software Freedom Day, I am teaching a short introductory seminar on creating materials with Cycles. Pretty soon I'll post more information about this seminar. The whole event is organized by a group of open source enthusiasts and professionals who come to showcase some of open source's most coolest tools. Also recommended for those thinking of switching to Linux.