December 25, 2018

UE4 - Biasing Material Function

For one of my products, I needed a function that biased a gradient ramp toward a specified value without washing out the entire range. I came up with a solution that works like this:

  • Insert gradient ramp, bias setting, and influence control.
  • Gradient midpoint figured from bias setting.
  • Power node controls gradient midpoint and pinches/expands gradient around bias setting

This expression is purely linear, but does a fantastic job biasing values with controlled influence and without losing range.



The scale on the left shows how different values affect the gradient ramp. While the pixels at the left and right remain black and white, the middle value (set to 0.2 in this example) remains the same, but its influence increases from -1:, with -1 resulting in a sharp black/white cut, -1:0 resulting in a pinched gradient, 0 at neutral (bypass), and anything >0 spreading the gradient further.

The bump for this biasing technique is 11 pixel shading instructions.

This has a lot of practical applications from processing or blending colors and textures in materials to more useful technical purposes biasing values. I'm using this to bias values from random number/seed generators to favor one part of the spectrum over another without losing the full range.

The power node/Influence variable is a bit weird to use, as the negative range is particularly aggressive while the positive range progresses slowly and continues forever. It can be more helpful to square the Influence setting for positive values, but squares do not result in negative values at all.

December 1, 2018

Blender Useful Shortcuts


Blender is a fantastic 3D modeling program, AND it's free! However, one of my biggest gripes with it is how insanely important functions are not always visible in the UI: you just need to hear the command shortcut from someone else to figure it out. I've listed below some of the less obvious, yet by far my favorite and most useful shortcuts in Blender:

General:


T - Toggle Toolbox (left pane)
N - Toggle Smaller Properties Panel (right pane)

Numpad 5 - Toggle Perspective/Orthographic camera
Numpad 7 - Top
Numpad 1 - Side
Numpad 3 - Front
Numpad 9 - Flip Side

Shift + Tab - Toggle Grid Snapping (grid settings in Properties panel under Display)

Edit Mode:


L - Select component - Even when objects are joined, selects independent pieces. When selecting edges, this command selects UV islands.
A - Select entire object
Shift + Alt + Select edge - Selects edge loop
Shift + Ctrl + Select two edges/verts - Selects all edges/verts between two points

F - Make face - Select two edges, press F, face will be made, joining selection)
K - Knife tool - Draw splits in polygons

Shift + D - Duplicate selected

Object Mode


Shift + D - Duplicate selected objects
Ctrl + J - Join two components together

UV Editor:


W - Align commands - Use to straighten and align UVs. Auto align works great!
Q - UV Sculpt - Enters UV Sculpting mode to let you sculpt and relax UVs
  • Click and paint - Moves and sculpts UVs
  • Shift - Relaxes UVs
  • Shift (toggle border in left-hand options) - Relaxes UVs without pinning border. Important for getting square UVs from non-square objects.

Tips:

  • To add material slot, click the + button located in the top right hand corner of the material panel (4 icons from the right in the larger properties panel). To assign a material, select all faces, in edit mode, select your material from the slot, then click Assign.
  • To prep an object for UE4 normals, make sure to export edge normals and use one of the following prep options:
    • In Object Data (chain link icon), select Auto Smooth. Set the angle to something that makes sense. This is good for simple meshes where the sharp edges are obvious.
    • In Modifiers, select Edge Split. This will give you options for using sharp edge selections in edit mode as well as a separate edge angle.
  • The best viewport rendering mode to work in is Material. This allows you to see the definition of materials on the object and textures while still being able to edit and work.