How can I make the stars twinkle?

Hi!

I’m using Unreal 5.2.1.

I want to make tinkle the stars on this texture:

How can I do it?

I think I could blend a noise texture that’s on a panner. Depending on the blending you choose, blacks should remain black, whites will be altered. I can play with a contrast on a noise texture to get more or less abrupt changes. But, I have no idea about how to that. I’ve found that description and it’s like reading Chinese.

Thanks.

1 Like

The easiest way I could think to do it would be to use two noise textures, pan them, and check against them.

In this top part, we use two texture samples connected to panner nodes. The default values for time and coordinate are fine, so we can leave those be. The speed, however, changes our flicker speed. Lower values mean stars will stay visible and invisible for longer.
We want to add the two textures together and divide them by two to normalize them back to 0-1.

We then simply check against our star texture. If the value of the panners is greater than or equal to the FlickerAmount, we show the star texture. Otherwise we just show black. The flicker amount is an arbitrary value, but higher means more flickering stars, lower means fewer flickering stars.

1 Like

Making those stars is not that easy.

Biggest problem is anti-aliasing and resolution of sky texture vs size of such texture.

My first take on shrinking size of that texture with just dots was to combine 3 or even more textures with dots, rotates and scaled:

Make texture with RGBA and each channel should be black with full 1.0f dots. So pure RED, Pure GREEN etc. then rotate them scale, shift etc. And sum all of them 0+0+0+0 is still 0. This way you will have texture mask that is less repeating than single texture.

However that was not enough for real skyboxes i still could see ugly aliases blobs.

So here is my latest idea:

  • instanced static meshes with unlit material and per instance color.
  • meshes should be just boxes, each should have random value (per instance random)
  • material can use that as offset and speed for flickering, then use perlin noise mask

Bonus is that you can randomly scale those meshes, and if your box is sphere, it is easy to spawn those star meshes, and you can easily do 200k of them.

Another attempt

image

stars

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.