|07-07-2009, 12:16 AM||#1 (permalink)|
Jack of a few Trades
[TUTORIAL]Baking Specular in Blender
This is something I've written before, but it was buried within another thread, and I've had problems finding it again when I wanted to show people. So I'm reposting it here, mostly for my convenience in linking people to it. But I hope others find it useful too. I wrote this tutorial from scratch, didn't copy it from anywhere.
This is a tutorial on how to bake specular onto a flat texture, in blender. It assumes basic knowledge of blender, so it's not for complete novices. There are other tutorials for basic things.
Specular is the white highlighting that you get when light reflects from a shiny surface. It's an effect that usually only exists in realtime rendering, as it depends on the point of view. Baking it permanantly into a texture can still have quite a striking effect, even if not technically correct. And often looks better than what the pitiful shininess option in SL can produce.
When I started with blender, I was annoyed at the lack of this functionality.
Turns out, this functionality is already there. It's just so hidden and convoluted that everyone on blenderartists didn't even seem to be aware of it's existence, and gave me all sorts of other even more convoluted and useless suggestions as to how to work around this lack (of a feature that actually is there)
Anyways, It requires material nodes.. The nodes basically work kind of like layers in photoshop, only a bit less simple.
First of all, you want to create our base material. However you want it to look. Then name it "yourmaterial_base" or something similar. I find having base in the name helps. Because when you go to work with the nodes, that won't actually be the material theat's applied to the mesh, instead, it becomes a node in the actual material, which pretty much provides most of the information.
After that, you make the actual material. Just create a new blank material on the object you're working with. That will be the node material. Once you've done that, in the Links and pipeline panel, there's a button marked Nodes. It's not hard to find, but you're probably subconsciously ignored it all the time you've used blender. That creates a node material, which you now have to edit.
Editing node materials requires a special windows, though. So split off a new window somewhere in the work area, or just convert an existing one if you have one spare. Select the windoew type as Node Editor
now, this is where we start needing pictures.
On the right there, is what the node editor window looks like. Node materials are built using this odd flowchart system .Each of the floating boxes is a node. In this case, there are two. The one on the far right is the output. That's where you put the finished result of whatever node editing you're doing. The other one, marked ClLICK THIS, is a material node (not to be confused with a node material). That's an input node, which basically imports an existing material, and can pass on it;'s information to other nodes.
There's a reason why I marked it Click this. In this case, a material node is of no use to you. They're too simple. (yes, really)
So click that node once to select it, and then hit your delete key to get rid of it.
Now you need to replace it. Right click anywhere in the node editor window, and select Add > Input > Extended material
Extended material nodes are functionally almost identical to normal material nodes, they just have more options, including the one we need.
Now, the net step, is to import the base material that you're working from. On the new node you just created, click the little arrows button, next to ADD NEW. And select your material from there. It's now used as an input.
Now, this is where the magic happens. You need to take both the color and specular data from that material, and merge them into one, then feed that into the output.
This picture shows how it's done.
First of all, you can connect nodes by simply clicking and dragging from an ouput (right side of a node) to an input ( left side of a node).
In the picture above, I've added a third node, in between the material and the output. That's called a mix node. You can add one by right clicking in the node editor, and select: Add > Color > Mix
Once you create that node, change it's type from Mix, to Add, because specularity adds light. Just click the arros next to where it says mix. And set the FAC to 1.0 Lower values will make your specular slightly less bright, but I think 1.0 is a good place to start, and tone it down from there if it's too much.
Next, create connections from the Color ouput of the material, to Color1 input on the mix node. And from the Spec output, to Color2. The order of those is very important. If you switch them around, there will be no specular.
Lastly, connect the color output from the mix node, to the color input of the output node.
Now. SAVE YOUR WORK. !!!
Then make sure the node material you've just created is applied to your object, instead of the base material you originally made, and bake it ias normal.
Voila, you have specular baked into the texture. And I have sore hands from typing.
|07-07-2009, 12:33 AM||#2 (permalink)|
Jack of a few Trades
And now, something I made with it. See attached.
Feel free to post stuff you've made with this technique here.
|07-07-2009, 11:45 AM||#4 (permalink)|
gazing lovingly into the smoking mirror
Join Date: Jul 2007
Location: Dallas, Tejas
SL Join Date: Feb 2006
Business: MadScience Laboratories
Seen this before in that buried link, but...
/me grabs Warkirby, pins the Croix du Blendre on his chest, and gives him a manly kiss on both cheeks.
"Don't believe everything you think."
|01-31-2010, 04:50 AM||#5 (permalink)|
Jack of a few Trades
I asked Cris to move this thread here, as I feel it will be more useful and reach the intended audience. Thank you Cristiano
|05-10-2010, 07:52 AM||#6 (permalink)|
Join Date: Aug 2007
SL Join Date: 2007-02-06
woah, I first got around to trying this now.
Thanks, WarKirby. This certainly makes a difference.
"I've always assumed I'm one of those people who knows a lot about planes, but I've never actually checked." -xkcd
|05-14-2010, 08:34 PM||#7 (permalink)|
Out of here
Bridges Not Walls
Join Date: Sep 2009
SL Join Date: 11-12-2007
Business: La Galleria
Thanks -- someday I want to try this.
|11-27-2012, 01:24 PM||#12 (permalink)|
Just call me Beth
Singing along with old music
Join Date: Mar 2011
Location: Out in the mists
SL Join Date: Oct 4 2009
Does anyone know if this will work for transparency baking as well?
|09-10-2014, 10:28 PM||#13 (permalink)|
Join Date: Sep 2014
Thanks for outlining the basics of how to do this. There is also a youtube vid ppl might want to check out:
Make a Shiny texture for opensim & SL with Blender with nodes -Bake texture with specularity - YouTube