BorrowedTorch.ContentPipeline 1.0.2

Prefix Reserved
dotnet add package BorrowedTorch.ContentPipeline --version 1.0.2
                    
NuGet\Install-Package BorrowedTorch.ContentPipeline -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BorrowedTorch.ContentPipeline" Version="1.0.2">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BorrowedTorch.ContentPipeline" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="BorrowedTorch.ContentPipeline">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BorrowedTorch.ContentPipeline --version 1.0.2
                    
#r "nuget: BorrowedTorch.ContentPipeline, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BorrowedTorch.ContentPipeline@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BorrowedTorch.ContentPipeline&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=BorrowedTorch.ContentPipeline&version=1.0.2
                    
Install as a Cake Tool

BorrowedTorch.ContentPipeline

A MonoGame content pipeline extension that builds ORMH textures: the four single-channel maps of a PBR material packed into one RGBA texture - R = ambient occlusion, G = roughness, B = metallic, A = height. You keep the maps as they came, write a small .ormh descriptor next to them, and the content build packs them.

What you get:

  • An importer and a processor for .ormh descriptors. A descriptor names where each channel comes from: an image, one channel of an image (optionally inverted - a gloss map read as roughness), or a constant.
  • The stock texture pipeline behind it: the packed map goes through MonoGame's own TextureProcessor, so mipmaps and compression are exactly what any other texture gets, set by the same parameters.
  • Rebuilds that follow the sources: every image a descriptor names is a dependency of the build, so editing one rebuilds the map - not only editing the descriptor.
  • No /reference to maintain: the package hands mgcb the extension on every content build.

The packing itself lives in BorrowedTorch.Ormh, which this package carries inside it; a tool that packs maps outside a content build can use that directly and get the same bytes.

Requirements

  • A project that builds content with MonoGame.Content.Builder.Task (a MonoGameContentReference to a .mgcb file), MonoGame 3.8.3 or later - or with BorrowedTorch's compute fork's builder, BorrowedTorch.MonoGame.Content.Builder.Task.Compute (from 1.0.1; 1.0.0 fails in MonoGame 3.8.6's pipeline with a MissingMethodException for ContentIdentity).
  • mgcb on .NET 8 or later.

Installing

dotnet add package BorrowedTorch.ContentPipeline

It is a development dependency: it adds nothing to your game's references or output, only to its content build.

1. Write a descriptor

Next to the maps, for example Content/Textures/Rock/ORMH.ormh:

// paths are relative to this file
{
    "ao": "AO.png",
    "roughness": "Roughness.png",
    "metallic": "Metallic.png",
    "height": "Height.png"
}

Each of the four channels is one of:

Form Meaning
"Map.png" The image's red channel.
{ "source": "Map.png", "channel": "g", "invert": true } Any of r, g, b, a; invert stores 255 minus it.
0.5 A constant from 0 to 1 over the whole map.

All four are required - roughness and metallic have no value that means "absent", so a channel left out is more likely a slip than a choice. Comments and trailing commas are allowed. Maps of different sizes are fine: the largest sets the size, and smaller ones are resampled up to it the way a GPU magnifies them.

2. Add it to Content.mgcb

#begin Textures/Rock/ORMH.ormh
/importer:OrmhImporter
/processor:OrmhProcessor
/processorParam:GenerateMipmaps=True
/processorParam:TextureFormat=Color
/build:Textures/Rock/ORMH.ormh
Parameter Default Meaning
GenerateMipmaps True As for TextureProcessor.
TextureFormat Color As for TextureProcessor. With DxtCompressed, height gets DXT5's own alpha block.

Premultiplied alpha and colour keying are always off - alpha holds height, not coverage, and premultiplying would scale the other three channels by it.

3. Load it

var ormh = Content.Load<Texture2D>("Textures/Rock/ORMH");

In the shader, one fetch gives all four:

float4 ormh = tex2D(OrmhSampler, uv);
float ao = ormh.r, roughness = ormh.g, metallic = ormh.b, height = ormh.a;

Using the MGCB Editor

The package passes the extension to mgcb from MSBuild, which the MGCB Editor never sees. To edit Content.mgcb there, reference the DLL in the file instead and switch the automatic reference off, so the extension is not loaded twice:

<PropertyGroup>
    <BorrowedTorchContentPipelineAutoReference>false</BorrowedTorchContentPipelineAutoReference>
</PropertyGroup>
/reference:<path to the package>/tools/BorrowedTorch.ContentPipeline.dll

Running mgcb yourself

A tool that runs mgcb on its own - an editor importing textures at runtime, say - passes the reference itself. The package sets $(BorrowedTorchContentPipelineDirectory) to its tools folder, which holds the extension and the library it needs; copy both next to wherever your tool runs mgcb from:

<ItemGroup>
    <None Include="$(BorrowedTorchContentPipelineDirectory)*.dll" Link="mgcb\%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

A descriptor built from a copy somewhere else still has to find its images: write the copy with OrmhLayout.Load(path).ToJson() from BorrowedTorch.Ormh, which names every source by absolute path. (Passing the folder as a processor parameter does not work: mgcb silently drops any parameter value containing a :.)

Known limitation

MonoGame's TextureImporter up to 3.8.4, which decodes images with FreeImage, cannot read 16-bit greyscale PNGs, as plain textures too (tested with 3.8.3 and 3.8.4.1). A descriptor naming one fails with a message saying so; save the map as 8-bit, as 16-bit RGB or as 16-bit greyscale with alpha instead, which all work. MonoGame's own native importer, which replaced FreeImage after 3.8.4, reads them: BorrowedTorch's compute fork's builder (3.8.6.101) packs a 16-bit greyscale map with this extension as it is.

Every version brings 16-bit values down to 8 bits by rounding down, v / 257: 0x8000 becomes 0x7F, 0xFF00 0xFE.

License

MIT.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 88 11/18/2026
1.0.1 115 11/14/2026
1.0.0 120 10/29/2026