Help! Shader for Particle vector fields


#1

eeb9fb813ba3c4fe573fa11d9c89c393

Credits to Distance based particle offsets using vertex shaders
for the inspiration

I want to use this to affect particle systems as seen in the original post.
I dont know how these particle vector fields would work but i need help with it.
I’d like to see if you can make this with just a shader and not a script for it. No movement just particles avoiding the main source.

Of course if the particles need the shader then that’s 100% acceptable I just need particles to move away from main object without a script

i dont know if this is possible with a shader or not but id like to try.

If possible id like for this to be possible without scripts. Though that might be impossiblee
Thanks a lot


#2

Hey there,

You don’t need a script at all, you only need to somehow feed the position of the object that you wish to interact with into your shader somehow.

After that it’s just a matter of subtracting the world position of your particle from the position of your interaction object and using that to offset your particle using the vertex shader.

Hope that helps :smiley:


#3

Thanks a lot, if i need to feed the position of the object i want to interact with. mhmm, im going to start thinking of a way to do it, do you think its possible with Amplify node shader tool??

Thanks a lot again
im truly inspired by what all of you make here, you have made me think of shaders and effects i could dream of creating without the inspiration from all of you


#4

It should be possible, as long as Amplify gives you read access to whatever you decide to use.

I’m not familiar with Amplify though, so I can’t tell for sure.


#5

what is read access? Im not familiar with these terms
Looked around but just saw masses of code no exact definition


#6

ive been playing around in amplify and i can only come up with a way to grab the source objects position, not the stuff around it, any terminology thats used? Or any logic behind grabbing some elses position? If i know the logic behind it i can probably get it to work somehow


#7

https://docs.unity3d.com/ScriptReference/Shader.SetGlobalVector.html

I remember using this, but only with shaderlab, I’ve not a clue wether Amplify can access global variables.


#8

im able to make a Vector 4 world spaced is that viable?


#9

forgot to mention that in amplify you CAN add custom code though i dont know how it would react with everything else


#10

Right now the only solution is to define a global variable to grab the position from it, but the only way to do that is to use a script isnt it???

How would i do that with a shader only???