Pbr Texture Bakery (For Eevee & Cycles)

by Daniel Mo in Surfacing


1. Getting startet

PBR Texture Bakery is now 2.8-ready yass!

So you decided to use the PBR Texture Bakery and want to create great PBR textures in Blender ... Now there are two possible starting-situations you might be in:

  • You already have objects with complex Eevee/Cycles materials on it. If that is the case, the bakery probably won't work directly for you. If you want it to bake your materials to textures you have to re-arrange your material so the bakery can read it - it must fit the prerequisits of the Bakery-materials. Depending on your material's complexity this can be very easy to achieve. Please read the "Bakery-material setup" - paragraph of this documentation to find out what is neccessary to bring your existing materials into an appropriate format.

  • You start your texturing process for an object from scratch. This is the easiest way to start from because while creating your material you can move along the Bakery-materials specification to keep the material in a bakable format (read the "Bakery-material setup" - paragraph to find out what those specifications are). You are able to create a material with ...
    • Albedo
    • Normal
    • Roughness
    • Metalness
    • Specular
    • Ambient Occlusion
    • Emission
    • Refraction
    • Sub Surface Scattering

2. The BakeryPBRShader
The PBR Texture Bakery is completely build ontop of a powerfull custom shader which combines Principled, Emission, Transparent and Glass shader into one shader. Well technically it is just a custom Nodegroup but it behaves like a new Eevee/Cycles node, PBR-shader. As soon as you install the addon it will be available in Shader-Editor under "Group -> BakeryPBRShader". The shader allows you to set all the mentioned properties from Albedo to Sub Surface Scattering:

  • Alpha | 0.0 (Transparent) - 1.0 (Opaque)
    Defines the transparency of your mesh.
  • Refraction Mask | 0.0 (not Refractive) - 1.0 (fully Refractive)
    Defines the refractiveness of your mesh.
  • Subsurface | 0.0 (no Light Scattering) - 1.0 (max Light Scattering)
    Use this input to define which parts of your mesh shall scatter light. This will be baked to a Subsurface scattering mask wich will only consist of completely black or completely white parts. Even if you define a value of 0.1, these parts will be baked as complete white.
  • Subsurface Color
    Defines the color which will be scattered.
  • Emission Color
    Defines which parts of your mesh emits light. Attention: Read "Emission Power" description too!
  • (Emission Power) | 0.0 (no Light Emission) - 60000 (max Light Emission)
    Defines the power of the light emission. This value will not be baked! It is multiplied with the Emission Color. If you bake the Emission Color, the (Emission Power) will be clamped to 1.0 and then multiplied with the Emission Color.
  • Base Color
    Defines the Color of your mesh. This value is multiplied with Ambient Occlusion
  • Ambient Occlusion
    Defines which parts use Ambient Occlusion. AO is mulitplied with Base Color in the BakeryPBRShader.
  • Specular
    Defines the specularity of your mesh.
  • Metallic
    Defines the metalness of your mesh.
  • Roughness
    Defines the roughness of your mesh.


3. The Bakery-Material
Please read the paragraph 2. The BakeryPBRShader before you continue with this paragraph ...

The PBR Texture Bakery can only bake materials to textures if you use a specific node-structure in your materials. This structure must be consistent in every material you use on an object. But don't worry: It is very flexible and offers you almost everything you need for realtime PBR. The structure of the Bakery-Material is very simple. The rule of thumb is: You must only use these shaders: The BakeryPBRShader and the MixShader and forget about all the other shader-nodes.

Apart from this you can use every other nodes to create your materials! If the bakery detects a wrong node at a specific position it will tell you what to do to fix it right. 

Rules for a Bakery-Material:

  • It must have exactly one Material Output-Node.
  • You are free to use Reroute-nodes everywhere!
  • The Surface-input of a Material Output-Node must be connected to a BakeryPBRShader or a MixShader
  • The first Shader-input of a MixShader must be connected to a BakeryPBRShader, a MixShader or can be empty.
  • The second Shader-input of a MixShader must be connected to a BakeryPBRShader or can be empty.
  • Rendered view (instead of material view) looks closest to final result.


The most simple material looks like this:

A more complex setup using 3 BakeryPBRShaders could looks like this:

Actual reallife example: Object consists of 3 separate meshes. Each one has its own UVs and material with at least one BakeryPBRShaders inside of it:

Materials were baked to an atlas-UVMap using the Bakery, imported and rendered in Sketchfab:


4. The PBR Texture Bakery - UI
After installing the PBR Texture Bakery it will be accessible in Object-mode of 3D Viewport in the "Sidebar" (toggled by pressing "N"):

  • Texture Name Prefix

This value defines the prefix that is used for the naming of the generated textures. E.g.: If you bake a normal-map for your "Cube.002"-object the resulting texture will be named "PBR_Cube.002_Normal".

  • Texture Size

Size of the baked textures in pixels. Maximum value is 8192.

  • Island Margin

Margin between UV islands in pixels.

  • Target UV

If you have multiple UVs you can define here which UV-map should be the destinating one. You can also use this to transfer textures from one UV-map to another (e.g. an atlas)

  • Use preferred render settings
    If this is enabled, the bakery will ignore your Blender settings render-sampling as well as the render device (CPU/GPU) and set it to "1" and "CPU". In very few cases you want to disable this option. For example if you want to bake a material which needs more than 1 render sample (e.g. Ambient Occlusion node). But most nodes don't need more than 1 render sample.

  • Exclude Selected UV-Verticies
    This function allows you to exclude certain faces from the baking process. Click "Select Excluded UV-Vertices" to switch to Edit Mode and select the excluded UV-verticies. Alternatively you can switch manually to Edit Mode and add, remove or show excluded faces:


    Excluded verticies will be stored in a new vertex-group (Bakery_Exclusion). This group will be automatically created and removed. Alternativelly you can also remove this group by hand if you don't want to use the "Subtract Selected Vertices From Exclusion"-function.

  • Channel Packing
    Here you can choose a bake-target you want to bake the textures for. According to the selected bake-target the channels of some textures (e.g. UE4 - RGB =Metallic, Roughness, Ambiend Occlusion) will be packed. Read more under "Channel Packing (Export Targets)".

  • Bake All
    This will bake all the textures as long as the checkbox next to its' texture-bake button is checked.

  • Save Textures
    This will save all the baked textures of your selected object. You must select the object you baked the textures from since it identifies the textures by the Texture Name Prefix, and the selected object. You will be asked for the save-location. All the textures will be saved at once in PNG-format.

  • Export Selected Objects
    This one allows you to export mulitple objects (meshes) - equal to what you get when you use blender's export functions. But in addition to that the bakery's export function also allows you to pre-process the exported objects. That means only the exported object (fbx, obj etc.) will become processed while your original object in blender's stage remains untouched. Read down below why this is useful. The export function offers you two options. If you have no one checked, no processing is made to the exported object:

    • Collapse Materials
      If checked every material (and material slot) will be removed from your mesh except for one, which is assigned to the whole mesh. This material slot will be named "Mat_<object name>".
    • Collapse UV Maps
      Check this option if you want the exporter to remove every UV Map stored inside of your exported object except for the UV Map you configured in the "Target UV Map"-property.

      Why is this useful? Your objects (meshes) might consist of multiple materials and UV Maps. The bakery's bake functions bake all material's textures onto one texture (material). After that you only need one material assigned to your object. Since the textures where created using one specific UV Map (you can choose it defining the "Target UV Map"-property) you only need this single UV Map in your exported mesh. If you want to export your object for an external application or production (e.g. U4, Unity etc.) you would remove those unneccessary materials and UV Maps by hand before exporting. That way you would destroy your object or work with duplicates of your object inside blender. The export function just does this cleaning process with the exported object and remains your original file untouched to keep the workflow as non-destructible as possible.

       

Channel Packing (Export Targets)
The PBR Texture Bakery supports channel packing. Therefore it generates the textures in the best possible format for a specific target. For example, Unity 5's standard metalness shader needs a softness texture instead of a roughness texture. It also needs the softness texture inside of the alpha channel of the metalness texture. The approriate Channel Packing preset for Unity 5 will automatically convert the roughness texture to a softness texture and pack it into the alpha channel of the metalness texture. Actually these Channel Packing presets are implemented:

  • Default (OpenGL/Unity Normals)
    • Albedo + Alpha
    • Ambient Occlusion
    • Normal (OpenGL +Y)
    • Specular
    • Roughness
    • Metalness
    • Emission
    • Sub Surface Scattering Color + Scattering mask in alpha channel
    • Refraction-Mask

  • Default (DirectX/UE4 Normals)
    • Albedo + Alpha
    • Ambient Occlusion
    • Normal (DirectX -Y)
    • Specular
    • Roughness
    • Metalness
    • Emission
    • Sub Surface Scattering Color + Scattering mask in alpha channel
    • Refraction-Mask

  • Unity 5 (Metallic - Softness/Alpha)
    • Albedo + Alpha
    • Ambient Occlusion
    • Normal (OpenGL +Y)
    • Specular
    • Metalness + Softness in alpha channel (Softness = inverted Roughness)
    • Emission
    • Sub Surface Scattering Color + Scattering mask in alpha channel
    • Refraction-Mask

  • Unreal Engine 4 (MRO)
    • Albedo + Alpha
    • Normal (DirectX -Y)
    • Specular
    • Reflection + Metalness in red channel, Roughness in green channel, AO in blue channel
      -> Roughness in green channel offers best compression quality
    • Emission
    • Sub Surface Scattering Color + Scattering mask in alpha channel
    • Refraction-Mask

  • Sketchfab
    • Albedo + Alpha
    • Ambient Occlusion
    • Normal (OpenGL +Y)
    • Specular
    • Metalness
    • Roughness
    • Emission
    • Sub Surface Scattering Mask (inverted SSS-Mask)
    • Refraction-Mask


Baking
The bake-process automatically uses the CPU for baking and renders with 1 sample. Since there are no raytrace operations there is no need for more samples (or even GPU usage). In addition to that, rendering using GPU can cause more trouble than rendering using CPU (GPU-compatibility, -memory etc.). Therefor the bakery automatically uses CPU for baking no matter what your actual render device or sample-value is.

Troubleshooting
If you encounter any bugs or problems, please let me know that and i will take care as soon as possible. Even if you have some recommendations or suggestions for further features, let me know that. I will this addon to be as good as possible ...

Releases and Changelogs

  • 1.2.0 (07.08.2019)
    Feature: Finally i implemented full support for Blender 2.8. Blender 2.79 and won't receive no updates any longer! If you want to use the Bakery with 2.79, please download Bakery version 1.1.1. If you want to use the Bakery in Blender 2.8 use the latest version.
    Feature: Added switch to turn off override of render settings. Now you can bake materials using GPU and more than 1 render sample. But use it with caution!
    Feature: Now you are able to bake only specific textures using the "Bake All" button. You can check and uncheck textures you want to bake at once.
  • 1.1.1 (12.10.2018)
    Feature: Added functionality for exporting objects with the bakery. Exported objects become pre-processed. See "Export Selected Objects" for further information.
  • 1.0 (22.04.2018)
    Feature: Removed the Bakery-Node setup frame and implemented a single powerfull shader (Nodegroup) called BakeryPBRShader. It allows you to bake more textures and set refraction and alpha from every shader (not only from Bakery-Node setup). It also simplifies the material creation process, makes the materials 100% consistent and more robust. This version is not downward compatible to older ones but future version will be downward compatible to 1.0!
    Feature: Added Channel Packing functionality. Now it is possible to bake textures for different render engines like UE4, Unity5, Sketchfab etc. Probably more to come. Therefore it also supports Normal Map +Y/-Y now.
    Feature: Added texture slots (Ambient Occlusion, Specularity, Emission)
    Bugfix 1: Baking did not work when scene-name was not "Scene".

  • 0.3.2 (25.03.2018)
    Bugfix 1: There was an error in the object-space to tangent-space normal-map conversion when
    used multiple bump- or normal-maps that use different UV-maps. The conversion used wrong UV-tangents which led to wrong tangent-space normal-map information. As a result of this the "Source UV" list was delete from UI. It is obsolete now. You only have to specify the UV-map you want to bake to.
    Bugfix 2: In certain cases the blue channel of the generated tangent-space normal-map was inverted. That was fixed by making the Z-vector (in tangent-space) absolute.

  • 0.3.1 (25.02.2018)
    Initial release

Regards :)

$7.99

Have questions before purchasing?
Login to message

Details
Sales 700+
Rating
27 ratings
Dev Fund Contributor
Published almost 7 years ago
Software Version 2.79, 2.8
License GPL