How ForceField texture animation works?

Hello everyone! Before I say anything, I have little-to-no experience when it comes to texturing and 3d modelling, so just bare with me on that point

Question: how come a simple gradient from black to white makes some weird animations? Should other colors be used? To understand how it works, I probably want to look at a gradient, where its first color represents a “starting point” of an animation, and last color represents “destination point”, if that makes sense

This is the texture I used (created in gimp with just 1 tool)

TestTexture1

Ohey I’ve actually dug into how the forcefield animation works a while ago. The documentation doesn’t do the feature justice. There’s quite a lot going on. The only documentation I know of on the developer hub is on this page and it’s not even correct. There is better documentation on the announcement topic.

How forcefields are animated

The red channel in your image controls which parts of your image are visible together. There is some invisible, internal slider that randomly goes up and down between the values 0 and 1. If any pixel in your image has a ‘red component’ that is close to the current value of that slider, the forcefield becomes opaque in that place. Below is a video similar to yours that shows this slider moving around between 0 (left) and 1 (right).

The image at the bottom is applied to the MeshPart behind it. The image is a simple gradient going from black (0, 0, 0) to red (1, 0, 0). When the slider reaches 1, the forcefield is opaque on the right because those pixels have a lot of red. When the slider reaches 0, the forcefield is opaque on the left because those pixels have almost no red in them. This of course also depends on how you UV-unwrapped your MeshPart.

The speed of the animation cannot be controlled. The thickness of the slider also cannot be controlled, so on average at any given moment about ~10% of your forcefield will be opaque. The only thing you have control over really is which pixels become visible at the same time by giving them a similar amount of red.

I am not fully sure how transparent pixels in the image are treated, but I believe that those transparent pixels will also always appear transparent on the forcefield animation.


This reads as if it was AI-generated. Texture instances are not compatible with the Forcefield material. You need to apply the texture to the MeshPart’s TextureID. Also, importing your texture in white ruins Forcefield animations as explained above. I’d recommend actually using the forcefield material before giving advice on how to use it.

3 Likes

Thanks for the answer! I kinda had an idea of a hidden value going in range [0; 1], but do you know is it linear? Because its behaviour is similar to EasingStyle.Bounce (sort of) which makes animating forcefields predictably impossible. If it is linear, then how a gradient will look like without these bounces?

The exact animation is a mystery. I couldn’t find any documentation on it so we would basically need an engineer to answer that question for us. I do agree that the animation seems to bounce a little bit and tends to stay more on one side of the slider than the other.

Sorry for the misinformation, I genuinely wasn’t aware and thought the issue was something different. Thanks for clarifying.

1 Like