Star filed Particles shader

Hi guys,
i´m trying to make a star field animation, but i have some problems wrapping the particles position inside the shader.
The idea is to have a continuous field for a 360° projection like in the attached cpu version.

any help would be great,

thanks in advance.

Ari (12.1 kB)
starfield_CPU.v4p (35.9 kB)

lets say you have a static pointcloud


will give you a continuous starfield but it’s size in Z direction will be 1, and you probably want to stretch it


this worked for me =)

wandering stars!!! wow, great idea lasal! i love it.

and, hej unc - please can you translate the additional comment for the little leecher users, please. i understand you a little fine. and i will work very hard.

here, made this in a patch

starfield.v4p (11.4 kB)

Hey Unc,
thanks for the tip, but instead a Z axis movement i´m looking for a XY movement.
I only need to wrap the positions in XY axis like in the attached CPU example.
For the moment i can only make a boundary for the particles but they hide when cross the limits.
in other words, is there any mathematical expression in hlsl to imitate the wrap Address UV behaviour?


frac() :)… no text …

I´ve tried it but frac affects to the whole cloud.
maybe i´m missing something?

And something like that? ;)

if (Pos < BoundsMin)
		Pos = "goes to final point";
if (Pos > BoundsMax)
		Pos = "goes to start point";

frac affects what is bigger than 1 and smaller than 0
first you need to transform your position from boundsmin…boundsmax to 0…1, then apply frac(), then strecth it if you need

Thanks unc!
it works like a charm,
as you wrote but with some changes. += frac(Transform + Time*Scale);

+1 for unc shader workshop at node :)

+1 unc and thx.

Hi lasal,
I’m looking for something similar
i changed the code accordantly flagged solution, but it doesn’t work for me.
if you still have it, can you upload your .fx pls.

Hey DiMiX,


hey lasal,
much appreciated, thanks a lot.

Hi, is there DX11 version of Starfield?

u can grab shader from the post just change the blend mode on add, and iinsert some particles texture…
however that shader not gonna work for the sphere 360 projection.