Material: Opacity Mask dithering

So I’ve been trying to achieve this effect for fading in/out my actors in plain view of the camera so that it doesn’t look like they just “pop in” at spawn. After a lot of looking around and trying out a few things, i came to the conclusion that an opaque material with masking was the way to go.

I could go for a random noise-like pattern that expand throughout the actor’s surface, which then makes the actor visible, but I’m trying to achieve a more stylized effect. If anyone’s familiar with MGSV you’ll have seen how elements fade in with a sort of dithering like pattern. SpecificallyI want to use an old pixel art technique for masking:


My first test was to use a single texture, UV map it using screen-based UVs and tile it up the appropriate amount of times on U and V, and pipe it into the opacity mask. This all worked perfectly using this texture:


My next step was to change up that texture sequentially (as animation frames), and I simply couldn’t get this to work. I’m using the following “sprite sheet”


I tried using the flipbook function in my material, but the problem I keep having is that I can’t adjust the UV tiling after I have sampled an individual frame of the animation. That is, I can’t retrieve an individual frame of the flipbook, THEN UV map that tiling across the screen…

My fallback is simply using the DitherTemporalAA function and just feed it an alpha value (0.0-1.0). This works like a charm, but i have no control over the pattern it produces (it looks good tho, so i might just stick to it)

My questions:

  1. Is there a better approach for fading in actors into plain view?
  2. Is my attempt to produce my own dithering a bad approach?
  3. If not, how can I make the tiling work as intended?
  4. If I were to stick to using the DitherTemporalAA function, are there any repercussions that I’m not considering? Can this effect be turned off by the user somehow (I wouldn’t want that to happen, but I want it to be an effect present in all clients).

I am also looking to do the same thing, except not to fade a mesh in, but to fade between 2 frames using the Flipbook function…if anyone could point us in the right direction it would be much appreciated!

BTW Pucho1982, would you mind sharing your current setup using DitherTemporalAA function?

  1. It is situational. Maybe stylized animated mask transition would look better.
  2. Not bad at all
  3. Multiply screen UVs by tiling factor before pluggin them to flipbook node. I would probably prefer having dither pattern in UV space of object rather than screen space though.
  4. I did not really dive deep in TemporalAA, but I think it is safe to assume that DitherTemporalAA node with TemporalAA disabled is just a simple screen-space noise. So your players should not be able to turn it off, unless they hack into the shader.

About you not having control over DitherTemporalAA results, well you can peak inside and maybe duplicate whole function and modify it as need. There is nothing fancy inside.

To get tiling UVs to work using the flip book node, it should work to simply multiply the input UVs by the tile factor and then use frac. You might want to disable mips for this kind of texture or edit the flip book function to force mip 0.

I wonder if you might be interested in this new ANIMATED GIF Plugin for UE4? It used to be a real pain to have ;simple; animated textures in UE4 when I started learning it 5 years ago. This is very welcome at least to me,. before I started in UE4. there were many things I would ‘animate’ in 3ds Max (and even 3D Studio for DOS way ‘back in the day’) using animated GIF’s (100% quality non dithered ones at any rate…) here is the info page direct:…h-gif-importer

I always wonder why they wouldn’t just have this in the beginning so it has been a long time coming,. (On the other hands it kept me from using Texture calls for so man things that I have now learned to do using simple procedural and random tricks to get thing moving!! :slight_smile: !