In this video, we will be creating an add-on for the Shader Node Editor called the Shader Library.
This Add-on was created for this tutorial and is not meant to be anything other than to demonstrate how it's possible but if you want to download the script you can download it here.
If you guys like it, I could look at developing it further but keep in mind that there are probably better Add-ons like this already!.
Using the knowledge from the previous videos and utilizing the template scripts, we can quickly create a Main Panel and add some bl_info, (Remember without the bl_info we can not install our add-on from file).
In the previous videos, we have been using Operations that are readily available, though in this example there are no functions that will create the Shaders that we want.
We have to create a custom Operator and then define (with python) what nodes we want to add to our Shader. We also need to then connect (or link as it's actually known) the nodes together.
I find it a good idea to add and arrange the nodes in a separate window as I write the code. It helps me keep track of what nodes I have added and it also lets me see how I need to link the nodes.
Alternatively, I would suggest writing down the Nodes you want to use before hand.
If you find moving the Nodes around pain, this may help.
The .location parameter will move your node anywhere you want but knowing which set of numbers will move it, Horizontally or Vertically is a bit of trial and error at first.
(-200, -90) - The numbers on the left will move the node to the Left or Right. The numbers on the right will move the node Up or Down.
So if we imagine that the center of the screen 0, if we want to move the Emission node to the Left we would type (-200,0). If we want the Node to move to the right we would type (200,0)
Using that logic, to move up would be (0,200), and down would be (0.-200).
For this Example, I start by creating a Diamond Shader. It doesn't matter what kind of Shader you want to create, the process is always the same.
We first create a Material and call it Diamond. Then we add the nodes that are required.
Once we have finished writing our custom Operator, we need to make sure we register and unregister all classes and then add the button (on the Main Panel) to call the custom operator.
Adding new Shaders becomes much easier since we can use the first Custom Operator as a template. We can copy and paste most of the code we have just written and then go through and change the appropriate details.
I decided to add a few Shaders that I thought were interesting and there are hundreds of different Shaders we could create.
Think we should add a specific Shader?. Let us know in the comments..
The Metallic Shaders are really basic. Though if you play around with some of the settings you can get some nice looking results. I would also make sure to follow your normal PBR Process when creating Gold, Silver, Copper ect.
I wanted this add-on to take out some of the hassle and speed up our workflow.
I hope you guys find this video helpful and as always, thanks for Reading!.
Just watched all your videos. And yes! I did mean ALL your videos. Amazingly explained and easy to understand. Thanks for sharing your knowledge...
ReplyDelete😊😉
Hey thanks for the comment. I am glad you found these videos helpful.. Thanks for the support!.
DeleteThanks for sharing. Darkfall is helpful.
ReplyDeleteHey Hosiyat, Glad you found them Helpful!
DeleteDude you are the man, keep up the good work!
ReplyDelete