For this project we were required to create a material with distortion and/or panning+wpo. I wanted to experiment with flowmaps, and decided to make pulsing veins.
I started by drawing the lines of the veins, and applied it to the flesh material which I downloaded here. I needed to get the angles for how the veins should dilate/shrink- Substance Designer's bevel node has a normal output, which I used the R and G channels for just that.
Textures can only be from 0-1, so in a normal map the middle/flat angle is at 0.5. For calculations I needed to make flat be 0, so I added -0.5 in Unreal before multiplying it with an even smaller number to weaken the distortion strength. For areas close to the veins however, I multiplied that with a higher number again to strengthen it.
Flowmap
As this is for UVs, the blue channel of the normal map is unnecessary (b= z axis) and I could put another mask there.
With the distortion made, I needed to mask the effect so it actually pulsed. I wanted the pulse to follow the veins as well, so I created a gradient mask- white the beginning of the pulse, and black the end. A range of this mask would be my "frames".
As I was iterating I tried two node setups:
Using frac'ed time and Pulse Size, I chose a range from 0-1 in the gradient mask to sample from, and used smoothstep to remap the values in that "frame" for the Pulse Mask. Since smoothstep will include values above your max as 1, I multiplied the output with another smoothstep but inverted.
I didn't account for under 0 and over 1 areas in this version, so the effect snaps- Then I started making version B because I felt there was a neater way to fix it. I kept this version behind a switch param anyways because truthfully, I kind of liked the "twitch".
Instead of getting a specific range, this version calculates the distance between the time and gradient mask. To make sure it looped properly, I also get the distance between the time -1 and +1, and use the smallest distance of all three.
With the Pulse Mask created, I used it to mask distortion and sent those UVs to base color, orh, and normals. I also used it to lerp base color between flesh and flowing blood.
Pulse mask
A. Snap Pulse
B. Smooth Pulse
The rest of the material. I added the Pulse Mask to world position offset for a lil' extra pizzazz.
Note:
Outside the material preview, wpo was causing the shadows to look wrong. Disabling virtual shadow maps quickly fixed it.
The pulse mask was quickly made by hand and edited with Designer- in hindsight, since I made the veins on a vector layer in Clip Studio Paint, I probably could have manipulated opacity with much more precision with that.
I'd also like to adjust the time frac so the beginning is much faster- to get a smoother snap of movement- ideally within a parameter. Curve atlas?
The "front" and "back" of the pulse is the same size. Might be able to use same solution for above for this.
Flesh Texture: https://www.texturecan.com/details/137/