Saturday 26 December 2020

Twinkle Twinkle, I said Twinkle... you little....

I wanted to make my small galaxy stars twinkle........what a simple idea....NOT


Boy its hard... mainly because there's no built in random function in shaders and shaders themselves only work on the info they are given, providing a uniform of something like time, and a random value from the attribute, means you get some varation, but its mostly an everything at once blinking effect.


Anyway, to cut a long story short, I found a way to generate random numbers from some of the input data, and in turn use that to alter the base colours.. Its not too bad, but the effect only ever lasts 1 frame, and is fleeting enough to give the twinkle effect I wanted, but adding some intensity variation and colour ranges is proving harder. Sadly a video grab doesn't show the effect well at all, due to the single frame nature of it, but it does work, it is shader based and it works well, so a few more tweaks and I will get a nice shimmering twinkling starmap.


after a bit more tinkering I came up with this, a bit too many brown stars but I can tinker a bit more.


No comments:

Post a Comment