Difference between revisions of "Arcane University:Baking"

The Beyond Skyrim Wiki — Hosted by UESP
Jump to: navigation, search
(Created page with "Baking is the process of taking a high poly mesh and copying its information into a shader which is being used to create a normal map. This way, a mesh can be rendered with hi...")
 
m
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Baking is the process of taking a high poly mesh and copying its information into a shader which is being used to create a normal map. This way, a mesh can be rendered with high surface information (good level of detail) but only using very few vertices (points) so the engine can render it at good performanc. The normal map appears to be a 3d detail but is actually a surface.
+
==Baking==
 +
Baking is the process of taking a high poly mesh and copying its information into a shader which is being used to create a normal map. This way, a mesh can be rendered with high surface information (good level of detail) but only using very few vertices (points) so the engine can render it at good performance. The normal map appears to be a 3d detail but is actually a surface.
 +
 
 +
== Baking options ==
 +
 
 +
When baking, you convert high poly information into the normal map. However, usually that normal map information is stored in a tangent-space based normal map. This means that the normal map doesn't actually store the direction, but rather it stores the direction relative to the ''tangent space''. What's most important about this is that it must match between the baking process, and what's used in game.
 +
 
 +
In baking programs, there are usually three options that determine whether the tangent space matches that in Skyrim, listed below:
 +
 
 +
* '''Tangent space''' - by this, it's meant which algorithm calculated the tangents themselves. Technically, this can be anything as long as the one stored in the nif matches what was used during baking. The de facto standard in most places is MikkTSpace (sometimes referred to as Mikk), so it's best to always use that.
 +
* '''Flip Y Channel''' (flip green channel/ DirectX). Because Skyrim uses DirectX, the normal maps should have their Y (i.e. green) channel flipped compared to the OpenGL standard. Is sometimes also just an option between DirectX/OpenGL, rather than saying what it does. In that case, choose DirectX. If this option is not present, it is also possible to later invert the green channel with a image manipulation tool such as Photoshop or GIMP.
 +
* '''(Bi)tangent calculation'''. Also known as 'Compute binormal/bitangent in pixel/fragment shader'. In Skyrim, the binormal/bitangent is stored per vertex and ''interpolated'' in the pixel/fragment shader. Therefore, make sure this matches in your software.
 +
 
 +
Below are listed examples for common baking software for what options to choose.
 +
 
 +
=== Blender ===
 +
Blender always calculates the bitangent in the pixel shader, so it can never perfectly match Skyrim. You should therefore not bake in Blender, but use one of the other options.
 +
 
 +
=== xNormal ===
 +
By default, xNormal uses MikkTSpace (as it's the only tangent basis calculator).
 +
 
 +
The green channel can be flipped in the normal map baking options, as shown below:
 +
 
 +
[[File:XNormal_flip_Y_channel.png]]
 +
 
 +
By default, xNormal will not calculate the bitangent (binormal) in the pixel shader (but instead interpolate from the vertex values). This is correct for Skyrim. If you want to double-check that it is set correctly, go to the plugin menu via the option shown below:
 +
 
 +
[[File:XNormal_Plugin_Menu.png]]
 +
 
 +
Then select <code>Tangent Basis Calculators > Mikk - TSpace > Configure</code> and check that the checkbox is unchecked, as shown below:
 +
 
 +
[[File:XNormal_binormal_calculation.png]]
 +
 
 +
=== Substance Painter ===
 +
 
 +
Substance Painter uses MikkTSpace by default, with no option to change it. In order to invert the Y channel and make sure that the bitangent is interpolated, use the normal map settings highlighted below:
 +
 
 +
[[File:Substance_Painter_Tangent_Settings.png]]
 +
 
 +
=== Marmoset toolbag ===
 +
 
 +
In Marmoset toolbag, make sure that the tangent space is set to Mikk, the tangent calculation Per-Vertex, and that the normal map Y channel is flipped, as shown below. Note that the default for Marmoset is Per-Pixel, so this needs to be set every time.
 +
 
 +
[[File:Marmoset_Tangent_Settings_Highlighted.png]]
 +
 
 +
Note that the option to calculate the tangent Per-Vertex was only introduced in version 4.03. Any version before that will use Per-Pixel, and should therefore not be used to bake normal maps for Skyrim.
 +
 
 +
==See Also==
 +
*[https://www.youtube.com/watch?v=9NfVyxHtKW0 What is Texture Baking? (Youtube)]
 +
* [https://www.youtube.com/watch?v=kGszEIT4Kww The Fundamentals of Perfect Baking (Youtube)]
 +
* [[Arcane_University:3D_Art#3D_baking_programs|3D Baking Programs]]
  
 
[[Category:Arcane University-3D Art| ]] [[Category:Arcane University-Method| ]]
 
[[Category:Arcane University-3D Art| ]] [[Category:Arcane University-Method| ]]

Latest revision as of 15:49, 23 November 2023

Baking[edit]

Baking is the process of taking a high poly mesh and copying its information into a shader which is being used to create a normal map. This way, a mesh can be rendered with high surface information (good level of detail) but only using very few vertices (points) so the engine can render it at good performance. The normal map appears to be a 3d detail but is actually a surface.

Baking options[edit]

When baking, you convert high poly information into the normal map. However, usually that normal map information is stored in a tangent-space based normal map. This means that the normal map doesn't actually store the direction, but rather it stores the direction relative to the tangent space. What's most important about this is that it must match between the baking process, and what's used in game.

In baking programs, there are usually three options that determine whether the tangent space matches that in Skyrim, listed below:

  • Tangent space - by this, it's meant which algorithm calculated the tangents themselves. Technically, this can be anything as long as the one stored in the nif matches what was used during baking. The de facto standard in most places is MikkTSpace (sometimes referred to as Mikk), so it's best to always use that.
  • Flip Y Channel (flip green channel/ DirectX). Because Skyrim uses DirectX, the normal maps should have their Y (i.e. green) channel flipped compared to the OpenGL standard. Is sometimes also just an option between DirectX/OpenGL, rather than saying what it does. In that case, choose DirectX. If this option is not present, it is also possible to later invert the green channel with a image manipulation tool such as Photoshop or GIMP.
  • (Bi)tangent calculation. Also known as 'Compute binormal/bitangent in pixel/fragment shader'. In Skyrim, the binormal/bitangent is stored per vertex and interpolated in the pixel/fragment shader. Therefore, make sure this matches in your software.

Below are listed examples for common baking software for what options to choose.

Blender[edit]

Blender always calculates the bitangent in the pixel shader, so it can never perfectly match Skyrim. You should therefore not bake in Blender, but use one of the other options.

xNormal[edit]

By default, xNormal uses MikkTSpace (as it's the only tangent basis calculator).

The green channel can be flipped in the normal map baking options, as shown below:

XNormal flip Y channel.png

By default, xNormal will not calculate the bitangent (binormal) in the pixel shader (but instead interpolate from the vertex values). This is correct for Skyrim. If you want to double-check that it is set correctly, go to the plugin menu via the option shown below:

XNormal Plugin Menu.png

Then select Tangent Basis Calculators > Mikk - TSpace > Configure and check that the checkbox is unchecked, as shown below:

XNormal binormal calculation.png

Substance Painter[edit]

Substance Painter uses MikkTSpace by default, with no option to change it. In order to invert the Y channel and make sure that the bitangent is interpolated, use the normal map settings highlighted below:

Substance Painter Tangent Settings.png

Marmoset toolbag[edit]

In Marmoset toolbag, make sure that the tangent space is set to Mikk, the tangent calculation Per-Vertex, and that the normal map Y channel is flipped, as shown below. Note that the default for Marmoset is Per-Pixel, so this needs to be set every time.

Marmoset Tangent Settings Highlighted.png

Note that the option to calculate the tangent Per-Vertex was only introduced in version 4.03. Any version before that will use Per-Pixel, and should therefore not be used to bake normal maps for Skyrim.

See Also[edit]