Legacy:Making Trim With The Extruder

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to navigation Jump to search

The Extruder Brushbuilder can be used to make segmented trim brushes. This tutorial assumes that you're vaguely familiar with the concept of the Extruder brushbuilder. See the Architecture topic page for more on trim.

(BTW peeps, this tutorial I'm sure will confuse all but the l33test of quaternion-jedi, so please feel free to edit. Yes, I'll add pics later but today I'm in Grouch-mode so I'm currently inclined to say "if you can't visualise in 3D go and edit for Tetris")

Simple corners

Let's suppose we have a square room created by a large subtractive cube brush. Adding another cube with half the dimensions will create a raised area in one corner. We're going to add trim around the edge. Suppose the large room is 256x256x256 (although the height doesn't matter), and the shelf area is 128x128x128. A corner of the small brush is on a corner of the large one.

The quick & simple way to add trim to this shelf would be to whip up two brushes, 256 long with a square cross-section of 32. However, for the sake of illustration we're going to do something a little more complicated. (If this is "more complicated" why should we learn how to do it? Common sense says simpler things work better.)


Leave the ShapeSource property set to "SO_pSquare" (the preset square). This builds a square of side 1 in the Extruder's ShapePoints array, so set the ShapeFactor property to multiply it up to the size of trim that we want: in this example, that's 32.


We'll be working with the path in Top view, so "up" & "left" refer to directions in that orthogonal UnrealEd Viewport. Suppose the shelf occupies the lower left corner of the room. The path needs 3 points, and it needs to go right, then down. The simplest way to describe this shape is:

  • [0] ( 0, 0, 0 )
  • [1] ( 1, 0, 0 )
  • [2] ( 1, 1, 0 )

Things to remember:

  • Unreal uses a left-handed coordinate system, so the positive y-axis goes down in top view.
  • The cordinates of the path are in the red builder brush's personal system. In other words, they're relative to where the RBB is placed in the world. (okay, that needs a rewrite for clarity)

The path coordinates are nice, simple numbers, that can be scaled to any size with the PathFactor property. An easy way to work with this is to set the grid to the same size as the value of PathFactor and then count grid squares. Here, set PathFactor to 128.

Just to confuse: with the relative paths option, describing a path with vectors is even simpler. Each vector is how far to travel from the previous point. The path in relative vectors is:

  • [0] ( 0, 0, 0 )r
  • [1] ( 1, 0, 0 )r
  • [2] ( 0, 1, 0 )r

The PathSource property tells the Extruder which method you're using to describe the path.

Try either method, press build, and line up the RBB to the correct spot and add it to the world. The texture may need to be rotated, depending on whether the trim texture you've selected is horizontal or vertical. If this is the case, select any of the trim brush's surfaces, press SHIFT+B and rotate them by 90 degrees. (related reading: Selecting Surfaces and Surface Properties Window).

External Corner

Suppose now that we want to add trim that goes around the base of the shelf. We could use the same brush and obtain a surface that's flush with the main wall. Alternatively, we might want a brush that protrudes like a step, or a brush embedded in the floor. The current shape of the RBB is too short at each end to do this.

We could simply use vertex editing or face drag on each end, or we could fiddle with the path points. The first method would be fine for a simple piece of trim like this, and the second method is fiddly because with the current PathFactor we'd need to type in fractions. Far too much work.

Instead, we're going to keep the path exactly as it is: it follows the edge of the shelf so from an esthetical point of view it makes sense not to change it. We're going to change the shape instead. Position the camera in the 3D viewport so you're level with the RBB and looking at the first path point. In the Top view the camera icon will be to the immediate left of the RBB. You'll see a red cross, the pivot point, in the upper left corner of the end face of the brush. The pivot point corresponds to (0,0,0) in the shape co-ordinates.

This is where it gets technical. The square that make the end face of the brush is the Extruder's initial Shape. It's been tilted by 90 degrees because the first path segment travels along the x-axis and not straight up. If you find this next section totally confusing, reset the path points to (0, 0, 0), (0, 0, 1) and it will be easier to see what is happening.

We want the shape to move from its current position 1 unit to the left, so the pivot point is in the upper right corner. As we're using the preset system to make the shape, we can tell it to do that very simply. The PresetMetrics array gives the presets module of the Extruder extra information about the shape we want.

  • The first pair of values gives the width & height of the square. They're currently zero, which tells the module to use default values.
  • The second pair of values gives the offset of the shape; in other words the 2-dimensional coordinates of the top left corner of the square in Shape-space. Confused? Try setting PresetMetrics[2] to 1 and press Build. The pivot cross stays in the same place, but the rest of the brush has moved down by 32 world units.

Now set [2] back to 0, and set [3] to -1. The brush moves back up and to the left. Looking in Top view, you can by selecting the added trim brush and the RBB in turn that their pivot point is in the same place: this is because they have the same path.

All we've essentially done is told the Extruder attach the shape to the path at a different point.

45 degree turns

Now let's make the shape we're trimming a little more complex. Either delete both trim brushes, or make another room in the world by duplicating the two cubes and rebuilding.

Use brush clipping to slice off a piece of the additive brush: cut diagonally across the corner that's in the center of the room – ie place a clip marker halfway along the top side and right side.

To trim this new shape, we need to follow its edge with the path as before. We'll need 4 points this time. If we work with the same scale the second point will be (0.5,0,0) so to simplify the points, change the PathFactor and the Grid to 64. Counting the squares gives our path as:

  • [0] ( 0, 0, 0 )
  • [1] ( 1, 0, 0 )
  • [2] ( 2, 1, 0 )
  • [3] ( 2, 2, 0 )

Note that these are absolute, so change PathSource back from earlier. The trim can follow the path on the inside or the outside, as above.

Legacy extruder.trim1.gif