Difference between revisions of "Arcane University:Baking"

The Beyond Skyrim Wiki — Hosted by UESP
Jump to: navigation, search
(Update with information about tangent calculation, as well as Blender and xNormal information.)
Line 1: Line 1:
 
==Baking==
 
==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 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 MikkT), 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]]
 +
 +
And then check that the checkbox is unchecked, as shown below:
 +
 +
[[File:XNormal_binormal_calculation.png]]
 +
 +
=== Substance Painter ===
 +
 +
 +
 +
=== Marmoset toolbag ===
  
 
==See Also==
 
==See Also==

Revision as of 19:01, 23 November 2023

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 MikkT), 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:

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

And then check that the checkbox is unchecked, as shown below:

XNormal binormal calculation.png

Substance Painter

Marmoset toolbag

See Also