The Blog

About Me


Marius Oberholster Hey! I'm having an incredible learning experience, not only learning how Blender works (yes, still learning), but also about Open-Source and the incredible software available. Stick around!

Optimizing Node Groups

Posted by Marius Oberholster on Wednesday, October 31, 2018 Under: Tips
Hey all!

NOTE: Don't just skim the headings - they are not clear enough for you to know what I mean.

I got to share with you all a special set of group nodes affectionately called 2Depth. These cover 2D to 3D conversion and some other depth based nodes. One in particular is called the parallax 3D node and this one was known mostly for it's slowness and secondly for it's sharp 3D results. Now, it's going to be the other way around!

The LORD helped me take the processing time down to 5 seconds from 30 seconds! That is HUGE! I cannot even begin to tell you what a difference that sort of time makes in a 3D workflow! 

A few days ago I felt led of the LORD to see if I can make the node faster. I had tried this before, so my hopes were really not very high to begin with. I tried it anyway and sure enough, the old tactics didn't work, but the LORD certainly did open my eyes a bit as to how many bad decisions I had made in the building of the node and that is where today's post comes in - how to help you optimize nodes based on this example.

 - Reduce overhead
While all of the tips can be added to this category, I am going to make it singular to 1 thing - make things faster while still achieving the exact same result (again, basically the same, but you'll get what I mean in a second).

This means that we want to take away things that make absolutely no difference to the final result (and there is more than you think). Sometimes we leave things on that make things slower without even realizing it, so this is to focus on that.

For the parallax node, this one had a surprising set of things that really made a big difference!

1) Removing a blanked image in favor of a color
2) Removing a conversion feature for something that was already correct

Let's kick-off with the first one. In the node, I have to run the same thing twice, this step has no image input, even though it does. The difference is that I am looking for the tears, not the image, so the image has to be white and the tears black. Initially, I had added a mix node to simply color the image completely white. Removing this so that Blender started with a simply white color (ie no input into the node), made a drastic difference in time.

The second has to do with the alpha over node. There is something called premultiplied alpha. This means, from what I understand, that if it is premultiplied, it just takes the open areas into consideration and lets your colors be your colors. If this feature is not used, it will be very additive in nature. This meant that I could turn off the "Convert Premultiplied", but had to leave on the premultiplied factor. Still giving a major speed boost!

Stuff like this will amaze you!

 - In as few nodes as possible
This one is a bit of a puzzle. Sometimes it is actually slower when you do it in as few nodes as possible...

In this case as well. I have the tear mask processed by the image's tearing and shifting, but using that alpha channel as a mask, makes the node go nuts. It is actually two times faster to have it run the same process on white as a color. I don't know why...

In other cases, using as few nodes as possible helps reduce the overhead and gets you higher speeds. For example, you can learn how to do something in 5 steps, but if you can do it in 2, why do it in 5, it doesn't make sense. For example the overall parallax adjustment.

I had in-painting nodes and blurring and masking and and and. It was really a mess of nodes that could simply be replaced with the displace node... I felt so silly! It made things so much faster. It does mean that the parallax is now in pixels, but regardless, it works and it's awesome! I encourage you to start with the default values that come with the node to get a good idea of what feels comfortable and what'll work when combined with the warping for compositing effects.

 - Different method, same result
I think this one made the biggest difference. It's similar to the previous one, but I want to make it a separate point, because it's something you learn as you go.

In Blender there are many ways to do the exact same thing. Some methods look better than others. Some are faster than others and shocking, some look exactly the same and differ monumentally in time needed to process. This should become even more commonplace with Eevee vs Cycles renders.

In the node, this came in the form of the RGBA nodes. I used them to break up the image so I could get the alpha adjusted, but this was a massive overhead step for processing, because it had to break up the image into 4 parts, change 1 and rejoin all 4. That is nuts!!! With set alpha you just do 1 and that's it. No wonder it made such a huge difference!

And of course, there are nodes that allow you to change the method used or samples used, etc. In these cases I recommend the fastest method that gives you the result that you want (sound easier than it is). I used Flat for the blur method in this node, because it is basically like reducing the resolution of an image. It works for the tears, because your attention is supposed to be elsewhere. Since the clarity of the blur doesn't matter and it should be selective with how much it blur and where on the image, it was the most logical choice. I would've luved to use Fast Gaussian, but the problem is that it does not support variation blur (similar to a defocus effect).

 - Test test test
I cannot stress this point enough! Every time you adjust something, you have to make sure that you still get the result you are looking for. If you don't, you have to be able to change it back. If you made 100 changes, how will you know which one it was that broke the result? Simple, don't make so many changes before testing. I will add this though - you can make a categorical change before testing. For example, turning off the conversion for all the alpha over nodes and seeing what happens. It's technically 1 change, because you know what caused a change if any and can correct it for whatever reason should you need to.

And that's it! Optimizing nodes is not an easy task and I know some optimizations can come down the line. Blender's inner workings have also gone through some major changes and the compositor will too. Until then, we really have the responsibility to keep optimizing whatever we put out there so that whoever uses it does not waste their time.

 - Final tip
This is one of those "doesn't matter to everyone" kinda tips. For the 3D, the slices do not come with anti-aliasing, this can leave some edges really harsh and ugly looking. If you feel inclined to do so, the post AA node for images does seem to have a good impact on this. It's totally up to you as the end user whether to add this or not.

I ran into a situation on Exodus this week where a sequence looked great for the 3D, but the original 2D looked awful (different blur method...). Anyway, I wanted to keep the clean2D (a term I use for the 2D version that will form the basis for the 3D render) for the Final2D and so I rendered it out and added some AA to it, because, like I said, some of the effects that enable it to be 3D (including the 3D itself) can make it look really harsh around the edges. Now, much much better!

Again, artists' choice. Won't happen with every scene, won't be needed with every scene.

I want to thank the LORD for pushing me to give this speed up another go. I learned a lot from it and I know you guys did too! The Node Editor can be really scary, but once you know how it works, it is really not that bad. You just need someone to show you and I hope this helps your workflow be much faster than you anticipated!

Know JESUS yet?

Have a great one!!!

Thank YOU!!!!!!

In : Tips 


Tags: god  jesus  holy spirit  blender  optimization  optimize  faster  fast  nodes  node groups  nodes groups  groups 
Social
(+27) 073 104 2834   |   marius.oberholster@gmail.com   |   Contact

Make a free website with Yola