(Re)Introducing Node Wrangler!

01

Just one of the new features, Viewer node for Cycles materials

Version 1.0 was, lets face it, not particularly useful. In fact the only thing I still use from it occasionally is that auto-arrangement feature. However, since the Zoom-Fit function inspired Henrik Aarnio to include it in trunk with the Alt+Home key, it wasn’t completely useless at all.

In fact, I’ve secretly been working on a whole bucket-full of new features!

Get the Node Wrangler!

I’ve made a page specifically for this addon, and I’ll continue to update it as I add more features. Here’s a summary of the features as they stand right now (but check the page for the very latest):

  • Viewer node for Cycles materials (Ctrl+Shift+Click)
  • Delete unused nodes (Alt+X)
  • UV Layer nodes – add an attribute node from a list of available UV maps with the name field already filled in (Shift+A > Input > UV Maps > [map name])
  • Switch the type of one or more nodes to a related type, like a different shader (Alt+S), keeping inputs and outputs connected
  • Swap the output connections of two nodes (Alt+Shift+S)
  • Reset the compositor backdrop image zoom and position (Z)
  • Frame the selected nodes (Shift+P)
  • Reload the images of all the image nodes in the current tree (Alt+R)
  • Quickly jump to the Image Editor and view the image of the selected node. Works for textures, movie clips, environment images, render layers, viewer nodes and masks.
  • Automatically arrange the selected nodes (or all of them) in a non-overlapping linear layout (Q)

The todo list is public on GitHub, as is the changelog which is updated automatically as I commit changes and new features.

That page I mentioned earlier has a lot more info on each feature, including a gif showing their usage.

Metropolis

image

I worked on this for a good couple days… it’s not finished, but I suppose it’s slightly usable.

There aren’t many city generators available for blender… in fact I only know of one, which is great but not very versatile. You kinda get what you get. What I wanted was a city generator that was so customizable that you could create any shape city of any layout of any scale on any planet… yeah. Obviously if it demands such vast possibilities, it can’t all be automated.

The plan was to have the user give it a set of buildings, a few images for scale/height maps and terrain stuffs, and even give it the street layout. The automation part is simply the placement of buildings along the streets. Simple. Yeah.

It’s probably the most complex stuff I’ve ever coded, not the hardest, just a lot going on to keep track of and integrate, while still keeping everything very customizable. It’s about 600 lines, which I suppose isn’t all that much to a seasoned coder, but for me it’s much more than anything I’ve done before :P

Placing buildings mostly evenly spaced and along a street is pretty easy, the challenging bit was preventing buildings from being created in the middle of an intersection, and along many curves at once without overlaps.

The solution was to increase the curve’s resolution a lot, convert them to meshes and join them all into one object. Then do a Remove Doubles to weld vertices that are close together. Why? Because this will join the lines together, making a vertex at each intersection that connects to both/all streets. Which means a simple search for verts with more than 2 edges connected will give us the position of the intersections!

image

Deleting these intersection verts, separating the object by loose parts and converting it back to curves will give us the perfect set of curves to but the buildings on to make sure no buildings sit in the middle of an intersection.

imageAnd that’s pretty much as far as I got. So it’s functional… just not really useful.

When I next feel like working on this, I’ve got a long list of todo’s… so probably not for a while.

The end goal would be to include a building generator and stuff like that too. I seriously considered turning this into a kickstarter, but at the moment I don’t really have the experience nor the time for something as epic as this.

Baking for Cycles

I stumbled upon a thread on BlenderArtists the other day – a guy called Simon Flores wrote a script that allows you to bake stuff in cycles and any other render engine for that matter.

bake_cycles

I wouldn’t quite call it baking, but in simple cases it could be quite useful. It goes through every face in the whole scene and places the camera facing it, renders it, and at the end of all that it joins all the pieces together. Genius right? Sort of.

It’s a great start, but there are some serious limitations:

  • The object you’re baking must be clear of any obstructions otherwise the camera cannot see it. That means that any non-manifold meshes will have artifacts
  • It’s really really slow, rendering a whole image for every single face. It took several minutes to bake a couple cubes.
  • The meshes must be triangulated first, since it can’t work with quads.
  • All meshes must be UV mapped and have the same image assigned to them in BI before baking (with no overlapping UVs of course)
  • Did I mention how slow it is? I started baking the Matball used on the wiki, with just 20 samples it was going at about 0.001% per second. That’d take 28 hours.
  • Since it places the camera on each face, any view-dependent shaders (like glossy, glass and anything with fresnel) will come out really weird.

If you can ignore or manually fix those limitations, then I’m sure you could do some pretty powerful stuff with it, perhaps creating a GI lightmap for a game. For now, I’ll wait until someone takes Simon’s code and gives it a UI and addresses some of those limitations. And speeds it up. A lot.

 

Progressive Animation Render Addon and Image Stacking

I remember when Cycles first came out, people loved the progressive rendering, where it shows you the whole image and gets clearer and clearer the longer you wait. But one of the first things people asked was “Can you render an animation progressively too?“. The answer was no. Until now that is.

I’ve created an addon that allows you to do exactly that.

proganim

(Download it!)

It’ll render each frame of the animation to its own folder (like path/to/render/frame_15/image.jpg), and then repeat the whole animation render again using a different seed, which means that there’ll be a different noise pattern. Then you can hit the Merge Seeds button and it’ll gather all the different images for each frame, average the pixel values and make a nice clean animation.

Continue Reading…

Node Wrangler!

Let your nodes arrange themselves!

(Download)

I challenged myself to some coding this past long-weekend. I have a nice big list of all the features I wish Blender had, and despite my recent addiction to python, are all way too hardcore for me to code myself… that is until now.

At work we use Maya mostly, so I often find a neat little feature that I wish Blender had and add it to my list. This time it was little button that arranged all your nodes for you, all nice and neat and linear. Surely something like this can’t be that hard to code, right? Well the more I thought about it, the more problems I found.

I checked out some weird and wonderful methods that other software uses, like Spring Force Directed Layouts where you basically simulate the nodes as if each connection was a spring to attract two nodes together, and all nodes that don’t connect, repel each other. After some simulation you get a pretty perfect node tree. Magic right?

The problem is that this technique is more for multi-directional graphs.

Graphs!

At least that was my excuse. Implementing physics algorithms is mostly beyond me for the time being.

So instead I did the logical approach. Fetch all the nodes that have no inputs (start nodes), and look at the nodes that connect to these. Put them to the right of the start nodes, then repeat for all nodes.

Node Wrangler UI

This ends up with one big long overlapping stream of nodes. So to separate them, I did another loop in all the nodes, if one overlaps another, move it down (by the dimensions of the node it collides with – thanks to lukas_t for adding this to the python API by my request!)

And after a couple more loops to make sure everything runs from left to right, it’s basically done.

Apart from this, I also added a button to delete all unused nodes and a tool to display the Backdrop image nicely fit in the window, but those were pretty tedious after the arranging thing.

So I suppose this means I should start tackling some more epic coding projects.

I work with nodes a heck of a lot, so if you’ve got an idea or request for an addon, let me know :) If you convince me that it’d be useful, I’ll do it for ya!