- Home /
Out-of-focus particle effect using shader (like PS3 home screen)
I'm trying to get the same effect that the PS3 home screen (or Naughty Dog's "Last of Us") achieves where the particles fade to a different texture when they are close to the camera. It would be an out-of-focus texture (such as a hexagon shape). You can see the effect on the left side of this image: http://i1.ytimg.com/vi/npR4iLzpCbU/maxresdefault.jpg
I've written a bunch of variations of shaders (both surface and vertex), that almost achieve the effect, but I think I'm stumbling over the fact that I can't get the actual world position of the particle I'm rendering.
I've tried using this (in a vertex shader):
float3 worldSpaceObjectPos = mul(v.vertex, _Object2World).xyz;
As well as the built-in Input.worldPos (in a surface shader), but they both give me back screenspace coords. Are particles simply not rendered in the same pipeline, and thus don't have a true world position? Is there no way for me to get a particle's distance to the camera?
Answer by glennpow · Jul 15, 2014 at 04:56 AM
For anyone who cares, this thread seems to explain the situation pretty well: http://forum.unity3d.com/threads/particle-world-space-coords.82640/
Your answer
![](https://koobas.hobune.stream/wayback/20220613153625im_/https://answers.unity.com/themes/thub/images/avi.jpg)