class MAGES::MeshDeformations::Editor::AlbedoBaker

Overview

Editor-only projection bake that transfers an original triangular mesh’s albedo onto a simulation mesh’s freshly generated per-wedge UV layout. More…

class AlbedoBaker
{
public:
    // structs

    struct BakeInputs;
    struct BakeResult;
    struct TriangleHit;

    // classes

    class OriginalMeshAccelerator;
    class Scratch;
};

Detailed Documentation

Editor-only projection bake that transfers an original triangular mesh’s albedo onto a simulation mesh’s freshly generated per-wedge UV layout.

The simulation mesh is a coarse tetrahedral approximation of the original, so this is a transfer bake (shrink-wrap the original’s texture onto the tet hull), not a UV re-parameterization. The algorithm, per the spec:

  1. Rasterize the new boundary triangles in UV space at the target resolution.

  2. Per covered texel, barycentric-interpolate the texel back to its 3D rest position and (flat) face normal on the sim surface triangle.

  3. Cast a ray ±normal against the original mesh (uniform-grid accel) and take the nearest hit within the max ray distance; on a miss fall back to the closest point on the original surface.

  4. Interpolate the original UV0 there and bilinearly sample the source albedo.

  5. Dilate island edges by the resolution-scaled gutter so seam filtering does not sample the background.

A single uniform grid over the original triangles backs both the raycast and the closest-point fallback. One atlas / single albedo is produced; per-submesh materials are out of scope. The extrusion / max-ray-distance is a computed hemisphere-offset today; a cage object (an explicit offset surface) is a documented future hook — see BakeInputs.Extrusion.