Forum

Star filed Particles shader


#1

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

Starfield_GPU.zip (12.1 kB)
starfield_CPU.v4p (35.9 kB)


#2

lets say you have a static pointcloud
then

pos.z=frac(pos.z+time)

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

pos.z=(frac(pos.z+time)-0.5)*ZScale

this worked for me =)


#3

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.


#4

here, made this in a patch

starfield.v4p (11.4 kB)


#5

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?

Thanks.


#6

frac() :)… no text …


#7

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";
		
	}

#8

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


#9

Thanks unc!
it works like a charm,
as you wrote but with some changes.

PosO.xyz += frac(Transform + Time*Scale);

#10

+1 for unc shader workshop at node :)


#11

+1 unc and thx.


#12

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.
cheers,dimi


#13

Hey DiMiX,

starfield-3d-gpu


#14

hey lasal,
much appreciated, thanks a lot.
dimi


#15

Hi, is there DX11 version of Starfield?


#16

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