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

03:22 PM

voxelMeta

Prefab Brush

raycasting

prefabs

friction reduction

pipeline smoothing

Uncommon Games

Animalkind

2026

The Problem: marketing scenes took hours of prep and iteration time

When making a video game, it's not enough for most projects to simply make the best game they can, release it onto Steam, and hope for the best from word-of-mouth. Realistically, you need trailers, social media content, and a whole heaping spoonful of luck. Trailers and other video content can be exacting, grueling work, with many iterations and revisions for even a 10 second shot. Furthermore, in-progress games have to create a beautiful corner that evokes the raw intentionality of a game from disparate systems that may not yet be fully implemented, meaning trailers and other marketing work can often require fully-constructing scenes that, before the work on the video ever began, were merely conceptual. In short: you have to place a lot of prefabs. For some time at Uncommon, this was done manually for every object in the game, from shrubs to Trees, which meant that making a forest involved manually finding a tree in the project tab, dragging it into a scene, getting it to land right, and then dragging more, then relying on copypasting objects which then often wouldn't align with the terrain correctly, etc etc. It was grueling, time consuming work, and it meant that making an entire forest could take hours we couldn't afford to spend.

Placing 100+ trees like this is a daunting task.

The Solution: a config-driven editor prefab brush

After doing it the hard way for a while, I finally spent the time to make a prefab brush, driven by internal configs, that would place prefabs in Animalkind automatically. It was designed to use internal configs you would create pointing to any number of prefabs, set an orientation, a density, and a brush size, anything you can imagine.

This is a far more efficient way to melt GPUs with alpha overdraw.

The Result: tens of hours saved per trailer and marketing video

Switching to the prefab brush allowed us to create an entire lush scene in a matter of minutes, even seconds, and iterating on something you didn't like went from taking just as much time as the original to being near-instantaneous. Not only was making a lush, deep scene faster than it would have ever been before, it genuinely unlocked the ability to do a level of detail that was hitherto unavailable to us, since the very act of trying to make a forest or foliage feel organic was deeply time consuming to the point where it was impossible to even justify trying. This multiplicatively sped up both trailer production, but also level design.

you can see the dots generating candidates as I place foliage

Key Features
  • easy brush config creation means you only look for an asset once

  • intuitive weights that allow tuning the random placement

  • ctrl+z and undo/redo support

  • auto-alignment and surface targeting

Results

0

saved per project

0

saved per project

0

decrease in level creation time

0

decrease in level creation time

0

to create a forest

0

to create a forest

0%

Sanity saved in further projects

0%

Sanity saved in further projects

The full

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

The full

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

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

STORY

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

STORY

The full

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

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

STORY

details for nerds

What we had vs what we wanted

One of my core early responsibilities at Uncommon was the sole production of video content, and it's really where I cut my teeth in game engine environments. As mentioned above, a lot of my early work was done manually placing objects piece-by-piece, but this very quickly highlighted friction in the process. Any time you wanted to do a revision for a scene for a video, it would be ten or more minutes of fiddling with prefab controls, notwithstanding the time it often took to construct scenes to begin with. This is when I first started to step outside of my purely content-based role and deeper into tech art, and it was largely to save myself time.

Aside from the laborious process of trying to find individual prefabs in a long list of objects, humans are bad at randomness. It's an innate human flaw--our idea of randomness is more like homogeny, and despite the randomness being pseudo, computers are far better at this than we are. So after the 100th time trying to tweak a forest, I finally decided to make a prefab brush that utilized controlled randomness with weights in configs.

This saves time both multiplicatively and additively. For example, every time I wanted to place a tree in the old method, I'd have to find it. This has an easy-to-miss tax associated with it in the form of having to remember what each individual and correct prefab was called (so I didn't accidentally grab the mesh object) that was eating up mental resources that could be spent elsewhere, but it also was a cost that had to be paid repeatedly. Every time Elm01 had to be placed in a scene, I had to find it, click, drag, rotate, etc. With a prefab brush, however, this cost is paid once, early, and then never again. You find every tree you want one time, put them in a config, give weights to them if you want there to be a bias, and then never spend a second thinking about Elm01 ever again. This is a cost that can be difficult to articulate to an engineer who is primarily focused more system-side, but is a relief immediately palpable if you're the person who has spent a hundred hours slowly rotating individual trees.

this is so much faster, and the undo is a life saver

The tool itself is quite simple, and built upon the interface framework I had already created for the Voxel brush (which was created for similar reasons), and the only real magic going on can be found in the collision solver, the raycast, and the undo.

Raycasting, collision, and undo, oh my!

The raycast does a lot of the heavy lifting in the prefab brush. Every time you clicked, rays would be fired downward at a maximum of 200 units to detect a surface. This could be naive, or it could be set to a specific parent object and ignore everything else (generally this is what I used.) Then candidate placement points would be located based on the density and brush size settings.

//each candidate starts as a 2D offset in the brush circle which
//is then lifted 100 units above the center's y.

Vector2 offset2D = (i == 0 && _softness > 0.001f)
    ? Vector2.zero
    : GetRandomPointInCircle(_brushRadius, _softness);

Vector3 sampleOrigin = new Vector3(
    _hitPoint.x + offset2D.x,
    _hitPoint.y + 100f,
    _hitPoint.z + offset2D.y);


If collision detection was enabled, it would then an OverlapSphereNonAlloc runs on the accepted point and if it passes, the object is placed. This filter is necessary for things like forests, but less necessary for foliage. Nobody really thinks twice if grass overlaps, but trees blending into each other generally looks absurd. 

//checking for collisions with a sphere projection
Vector3 checkCenter = surfaceHit.point + surfaceHit.normal * _collisionCheckRadius;
int     hitCount    = Physics.OverlapSphereNonAlloc(
                          checkCenter, _collisionCheckRadius, _overlapBuffer);
bool blocked = false;
for (int j = 0; j < hitCount; j++)
{
    if (!IsOnTargetCanvas(_overlapBuffer[j].transform))
    {
        blocked = true;
        break;
    }
}

Undoing was one of the features that likely saved more time than anything else--since we were relying on random placement, things would sometimes just not look the way you hoped, even with weights properly tuned, so being able to click, then ctrl+z and then click again instantly really saved a profound amount of headache and likely sped up this process almost as much as the brush itself. Just one too many purple flowers? Just a simple undo away.

//registering objects in the undo sequence is small but is
//a HUGE QOL improvement.

GameObject go = (GameObject)PrefabUtility.InstantiatePrefab(prefab, _targetParent);
go.transform.position   = pos;
go.transform.rotation   = rot;
go.transform.localScale = Vector3.one * scl;
Undo.RegisterCreatedObjectUndo(go, groupName);
Known Limits

This was one of the simpler tools I implemented for my work at Uncommon, but it also saved me some of the most time out of all of them, and it illustrates, I think, how a little bit of slowdown at the onset of a project can return that time investment tenfold. I was able to produce the footage for our trailer in just about 3 or so days because of this brush, which otherwise would not have been possible at all. That said, it has some limits, some inherent to the tool, and others to the game:

  1. the raycast is global - 90% of the time, this isn't a problem at all, but when it is, it's deeply annoying. The raycast should be offset from the brush, not a global vector, since this essentially means you can't paint under anything with an overhang.

  2. foliage is beastly - this is more tied to the game's general performance and structure, but it is a limiting factor nevertheless. Foliage ideally should be distributed via compute shaders and not real prefabs, which would change how this tool operates significantly, as we'd go from painting actual prefabs for foliage to regional weights. This tech was never implemented in Animalkind, however, so it became a moot point.



1
1