hourigan.info - portfolio ·

work

live

~/

portfolio

›

src

›

work.done

›

<

section

hero

/>

⌘K palette

⌘P files

main

↓0↑2

0 errors

open_to_work

UTF-8

•

HTML

•

Cincinnati

02:40 PM

voxelMeta

Bulk Texture Baking pipeline tool

textures

normals

scaling

baking

Shoddycast Inc.

Devils' Advocate

2026

The Problem: authoring assets takes forever

This is the companion piece for the Procedural Painterly Shader, and is what justifies the entire effort to create an authentic, coherent art style while reducing the amount of time spent hand-painting hundreds of assets, thus allowing the Devils' Advocate project to take advantage of the hundreds of thousands of premade assets on the marketplace. The problem is that even a small object with a known profile can take tens of minutes, maybe even hours depending, to do the art for, which makes creating living, breathing worlds with an opinionated art direction outside the scope of what's possible for anything outside the budget of a AAA studio. Small indie projects, or even AA projects, are essentially limited to a small pool of handcrafted assets OR into fully relying on the marketplace to provide art design for them, as they can't justify the hundreds of hours it takes to design and produce hundreds of textures for a given aesthetic.

The Solution: only author hero assets, bake the rest in bulk

Hero assets (main characters, important props, etc) are almost always deserving of handcrafted attention, and thus are worth the investment of an individual artist spending time to really get it right, but everything else can be difficult to justify. A huge portion of a 3D model's identity comes from the texturing work, as you can see from the example here:

Most of a model's identity comes from the texturing, which can be changed very easily

Therefore, if it were possible to somehow take advantage of the hard work others have done to create asset packs that are already easily-integrated into your game engine while also adhering them to a coherent art design vision, you could potentially unlock a scale of gameplay or storytelling that would ordinarily either be visually limited or altogether impossible. This is where my bulk baking solution comes in to save the day. It's built upon the foundation of Blender, and it is capable of baking any shader that can ultimately be expressed via textures en masse.

The Result: thousands of assets fully-authored in just hours

As this was initially designed specifically to take advantage of the Painterly Shader I conceived as the shader is not real-time viable, my initial tests ran rather slowly (this is not altogether surprising, as it needed to compile OSL for every single object), and it serves as an excellent example of the worst-case scenario one can imagine: an incredibly beefy shader that would never work on its own, and yet it could still process 110 meshes and 168 associated textures at 4k resolution in just 23,032s (just under six-and-a-half hours), making even a poorly-performing shader capable of producing tractable results in a simple overnight job. The same assets running through a much simpler test case shader ran much more quickly, running the same job at 8k resolution in only 7232 seconds, or just over 120 minutes. This puts the floor for a heavy 8k job at 18 hours per 1000 assets (this is meshes with multiple PBR textures), which is a scale that no human being could possibly match. One could decide to tweak the entire art design of their game, and as long as it could be reasonably expressed as a texture in some capacity, it's just one overnight job away on a cheaply-hosted server or even a personal computer if you don't need 8k resolution.

hover over an image to see its realistic source asset

Key Features
  • runs offline

  • can process 300 4k textures per hour

  • fast and free

  • export manifest makes automating imports extremely easy

Results

0

saved per 100 assets

0

saved per 100 assets

0

textures per hour

0

textures per hour

0

per 8k texture

0

per 8k texture

0%

free (thanks Blender)

0%

free (thanks Blender)

The full

/////////////////////////

The full

/////////////////////////

/////////////////////////

STORY

/////////////////////////

STORY

The full

/////////////////////////

/////////////////////////

STORY

details for nerds

Why Blender

The primary tool for this job was Blender, which was chosen for a few reasons:

  1. Blender is free and requires no licensing.

  2. Blender has a nearly-fully-integrated capacity for running python internally.

  3. Blender has a fully-exposed API that can integrate with this scripting

  4. This API can be run headlessly, cutting down on resource requirements for a bake exponentially.

Item number 4 is the real powerhouse here--since you can run Blender jobs in a terminal, you can cut down on all the slow processing associated with user interfaces and rendering things visually and focus just on the baking process, which cuts down time exponentially. Not only this, but it also dramatically reduces the amount of internal development one would have to do in order to create a bulk-baking tool, as Blender handles all of the logistics, timing, and compiling essentially for free. The entire development cost, therefore, is just in properly hooking into the API.

As soon as linux people find out you can run Blender in console, it's over.

Pulling hardcoded factors into configs

While initially designed with the Painterly Shader in mind, I decided to generalize this tool so it could bulk-bake any style imaginable as it would be useful for my day job at Uncommon Games. I don't generally believe in what Alton Brown called "unitaskers" if it can be helped, as they can entrench design decisions and cement tech debt. The time spent generalizing a tool can often seem like wasted time when you just want to move forward, but I've found that the benefits almost always pay off in ways you don't initially predict when you're in the "I just need to get the thing done" headspace, and you end up thanking yourself later for being patient and making a tool more flexible.

#the actual config is much longer, but this shows the general thesis of the project,
#which uses a main config which then points to other documents and configs in order
#to properly map, bake, and export textures.

{
  "project": "penthouse_simple",
  "input": {
    "type": "fbx_index",
    "index": "K:/UE5Projects/ApartmentPainterly/Saved/TextureManifests/_index.csv",
    "manifest_dir": "K:/UE5Projects/ApartmentPainterly/Saved/TextureManifests",
    "model_dir": "E:/AssetExportPainterly/Game/Penthouse/Meshes",
    "texture_dir": "E:/AssetExportPainterly/Game/Penthouse/Meshes",
    "unverified": "skip",
    "overrides": null
  },
  "source_config": "sources/ue5_manifest.json",
  "shader_config": "shaders/simple_principled.json",
  "source_material": {
    "assign": "all_slots"
  },
 
  "bake": {
...
    "per_object": {},
    "resolution": {
      "mode": "match_source",
      "from_role": "albedo",
      "fallback": 1024,
      "fixed": 1024,
      "min": 1024,
      "max":1024,
      "clamp": [
        256,
        8192
      ]
    },
  }
}

Thus, everything that was initially hardcoded was pulled into a config structure that properly maps input textures and channels to output channels, as well as holding just about every setting one might imagine needing for a bake. Samples are a huge potential time risk, as a lot of people stick with the defaults, but if you are using 8 samples when baking a pixel-precise texture, you're almost always wasting time (8x the time, too!). Configs are what empower this as a generalized tool, and essentially stymie any unitask risks.

Manifesting Textures

Alongside just baking textures, the tool also accepts incoming manifests, but more importantly, outgoing manifests that tie textures and assets together. This is vital plumbing for saving time and allows a level of automation that otherwise would make this tool feel half-baked (I'm sorry). The import/export manifests are the most "hardcoded" component of this tool and are what I would spend more time on refining, given more time, but even so, with some lift, fully-automatically building new materials in Unreal or Unity is trivial with the sidecar CSVs.

reimporting and building textures and materials can be done with a single click thanks to the manifests

Some fun math

This is more of a footnote than anything genuinely important, but I found the unintuitive timing disparities pretty interesting. When I baked my initial pass at the painterly texture set, it was 2k textures, and it took 3h17m to bake 168 textures. Therefore, when I went to bake the 4k textures after I was sure my settings were correct, I expected it to take roughly 13 hours. This is because a texture is a square, and to go up a "doubled" resolution (i.e. 2k -> 4k), you're going from 2048² to 4096² pixels, which is a 4x pixel increase. Instead, the 4k bake took only 6h21m to bake fully, which was a 2x increase (less, actually, 1.94x!) This pushed me to run some tests on simpler shaders to see how the baking tool performed with less noise, and so I made a simple shader setup that boosted saturation on the albedo but otherwise piped everything through as-is (but still rebaked textures) and the results were pretty interesting:

  • Bake time vs Resolution

    Time taken to bake in seconds

    You'd expect to see an immediate exponential increase it doesn't start to hint at this growth until later

  • Time Efficiency vs objective resolution drop

    //the amount of time you save if you drop down to a given resolution from 8k compared to the resolution one higher

    relative speed gains controlled against 8k resolution

As you can see, there's not a large change in the time taken to bake from 256->2k, seeing only a 67.83% increase in time taken to bake these textures despite the resolution being 64x larger. when we get from 4k->8k, only then do we start to see numbers resembling the proper 4x progression, with the 8k resolution taking 3.5x the time 4k took to bake.

This is due to a number of factors I didn't initially consider:

  1. parallel efficiency improves with resolution - this baking tool currently runs linearly (my PC can barely handle this) but this efficiency gain here is more philosophical and computational. More texels means more work units in total and proportionally less core idling at the end of a bake time, meaning more of the time spent in the process is actually baking. At lower resolutions, there's a lot of read-write/close-open noise that can't be easily mitigated without a bespoke process, and this starts to become invisible at higher resolutions.

  2. margin costs scale with perimeter, not area - bake.margin is a fixed pixel width, so it does in fact scale with the single-dimension for the most part.

There's a formula one could use to predict bake times if they were so inclined, t = F + V * px, which can be used to compare relative texture ratios, but the general explanation is: at lower resolutions, the setup dictates the time taking to bake, and only at about 4k resolutions does the pixel density start to become the primary driver of time.

On the subject of time, baking into HSV instead of RGB is an assumed support structure here, since it can make some color correction/adjustment methods in the engine-side system a bit easier and lighter-weight, but over time it became a bit obvious to me that this was likely too expensive to justify for most shaders that were somewhat-heavy. Once you've developed your RGB albedo, it's going to be faster to post-process that into an HSV texture rather than computing it at bake time. This leaves all the complex shader computation where it needs to be (Blender) and defers HSV rebaking to a later date, which can likely be done in just a few minutes rather than several hours for some of these complex shaders. That said, there are reasons to think it could be necessary at the shader level if one expects to need more finetuned color mapping.

1
1