UE4 material - Randomly place a flipbook sequence?

unreal

#1

Hi. I have been making a rain drop material in ue4.
After making a single ripple sprite in substance designer, I imported the image in ue4, and made a flipbook animation with it. Now what I want to do is scale down this animation and randomly place them.
How could I achieve this?


#2

With your current approach, you’d have to copy the entire setup multiple times, then add the results. I’ll describe it below, but I recommend approaching it differently. One option would be to Scatter the circles already in Designer, making a tiled animated texture.

An a more sophisticated method can be found in Taizyd’s tutorial: https://deepspacebanana.github.io/blog/shader/art/unreal%20engine/Rainy-Surface-Shader-Part-1

If you really need to stick to your current texture – You’d need to Multiply the UVs first to scale them, then Add some offset (constant vector2). After the add, use a Saturate node to clamp the UVs to 0-1 range (anything bigger than 1 will stay as 1). This will give you a single drop, smaller and moved.

Instead of using UV output from the SubUV, attach a Texture Object as the input and use the Result output. Then you have to copy this entire setup a few times. Take all Results and Add them together. Use a Normalize node after the last Add, to make sure the normal vector is a unit vector (length of 1). Put that into material’s Normal slot.

This method would be slow in terms of performance, because a texture read (aka sampling/fetching) is one of the heaviest operations in a shader, and here you got a lot of them.


#3

Thank you for the reply! I have two questions about it.

First, if I were to place those ripples where rain particles hits the surface, would it be better to make them into particle system?

Second, in the Substance Designer, I tried to expose offset from a transform2D node, but somehow the result node couldn’t be set as an output.


the result needs to be a float2, but somehow vector2d node was unable to take two floats into a float2.
btw, what I need to achieve with this fuction nodes is repetition between -1.4 and 0.8 for the y offset.


#4

Hey. As for Transform2D, I don’t know. Ripples from particle collision – no need for such precise interactions :slight_smile: Nobody does it so expensively. Just make them animated in a quite similar intervals to the falling rain’s speed.


#5

Right. Thanks to your replies its been a huge help :slight_smile: