Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Surface Shaders for Particle Systems

Discussion in 'Shaders' started by keeperkai2, Dec 3, 2012.

  1. keeperkai2


    Oct 26, 2012
    I've been trying to write "scan effect" shaders for my game. These scan shaders are all transparent, and certain regions in world space(by doing calculations on IN.worldPos) would be enhanced in the alpha channel(due to the input I give the shaders). Everything works fine( meaning the right parts are enhanced in alpha when I give them a certain input), except when I use these shaders on the "billboards" renderers of particle systems(it works fine when I use mesh renderers for particle systems). When I do so, the regions that are alpha enhanced seems to change as my camera moves/rotates.
    So I'm guessing when I use the IN.worldPos on "billboard" particle renderers, it somehow gives me viewspace coordinates instead of the world space position of the billboard fragment? Does anyone know anything about this? Is there anyway to get the world position of the billboard fragments?
    If the coordinates are indeed in view space, maybe I can get the worldposition by multiplying the view space position with unity built-in transform matrices to get the world space position. However, I found this thread:
    stating that the built-in variables/matrices are not properly exposed to the shaders in particle systems.but there's not much discussion there and it was posted 1 year ago, so I don't know if the conclusions there still stand.