- Home /
How to edit the new particle surface shader? / Make it so particles receive light from all angles
I would like to edit the code in the particle surface shader. But it cases Unity to crash. I downloaded the standard asset shaders from unity's website. I first tried only adding the "Particle Standard Surface.shader" file, but that caused unity to freeze (the unity shader compiler used up all CPU power until i force closed it). And the shader didn't work. I tried adding all the standard shader assets, which didn't case a freeze, but now i don't know how to add my own code to that shader. I tried adding the "diffuse wrap" shader code from
.
https://docs.unity3d.com/Manual/SL-SurfaceShaderLightingExamples.html
.
but that gives me 3 errors:
.
"Shader error in 'Particle Standard Surface': CGPROGRAM cannot contain #pragma surface as well as other programs at line 73"
"Shader error in 'Particle Standard Surface': Surface shader vertex function 'vertParticleShadowCaster' #0 parameter has wrong modifier; has no modifier but needs 'inout' at 'VertexInput v' at line 73"
"Shader error in 'Particle Standard Surface': Parse error: syntax error, unexpected TOK_PASS, expecting TOK_SETTEXTURE or '}' at line 74"
.
And i don't know what any of those errors mean. Well i guess know what the first two means, but not why or how to fix.
.
Have never made a particle shader before so i don't even know where to begin. And i can't find any examples online.
.
What i am trying to do with the shader is so the particles receive light from any angle. So light basically "shines" through. If you point a flash light at a sheet of paper, you will see the light from the other side, the paper doesn't completely block the light. I need this because im making a dark top down game where the character has a flash light(spot light) on his gun. Since the camera is from above the particles faces the camera and this is almost 90 degrees away from the light (the light is slightly pointed downwards) which cases the particles to be COMPLETELY unlit. Any ideas of how to fix this? Either by teaching me where to even try to start with editing the particle surface shader or by some other hack or variable to change or whatever.
.
And yes i have tried to make the spot light point even more downwards, but it needs to be at like 45 degrees for it to light up the particles the way i want, And having the light at 45 degrees fucks up the way i want the light to be for everything else (also it stops looking like a flash-light light at that point)
Your answer
Follow this Question
Related Questions
Shuriken values in shader code? 0 Answers
Control light intensity via shader script 0 Answers
Unity inbuilt distorsion shader? 1 Answer
Limit particle shader / discard from certain worldpos 1 Answer
Particles effect in a progress bar 1 Answer