Handprint highlight material and component

BP_HandprintComponent, MPC_Handprint and MF_Handprint are the main elements of the hand location highlighting sytem.

BP_HandprintComponent

BP_HandprintComponent is a scene component that should be added as a child to each hand of the player pawn. It has an editable bool parameter called IsLeft, which should be true for the left hand and false for the right.

All this component does is take it’s world location and store it in MPC_Handprint.

MPC_Handprint

MPC_Handprint is a material parameter collection containing seven scalar and four vector parameters. These values can be set by BP_HandprintComponent or any other script, and are used by MF_Handprint.

  • DistanceMin and DistanceMax specify the range of distance from the hand to the surface over which the highlight is visible
  • Size is a multiplier for the size of the highlight. The visible size is also affected by the distance to the surface.
  • LeftAlpha and RightAlpha are used to lerp between opacity and transparency for each hand, or to hide the highlights altogether.
  • LeftFill and RightFill are used to lerp or switch between the two masks: T_HandprintMask_0 at a value of zero and T_HandprintMask_1 at a value of one. This would be use for example by other scripts to show when the hand is in range of a target.
  • LeftColour and RightColour specify the colour of each hand’s highlight. The alpha chanel is not used.
  • LeftPos and RightPos are updated by BP_HandprintComponent with the world location of each hand.

MF_Handprint

MF_Handprint is a material function that takes a base colour as input, and outputs a base colour with hand highlights, as well as an emissive channel.

It works by taking the world co-ordinates from the hand, via MPC_Handprint, and projects them into screen-space, using the distance between the shaded pixel and the hand to calculate the size of the highlight.

a section of MF_Handprint

The colours, overall alpha and mask lerping alpha are all also taken from MPC_Handprint.

MF_Handprint should be included in any other base material that should display hand highlights, like in the following example:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: