Search Unity

Sparkle shader

Discussion in 'Shaders' started by MaT227, Dec 16, 2012.

  1. MaT227

    MaT227

    Joined:
    Jul 3, 2012
    Posts:
    628
    Hi,

    I am trying to create a sparkle effect on a shader.
    It looks like some points sparkling on the specular surface, I want to use a specular map (it's a noise map), I've already implemented that feature in my shader but I don't know how to make some points sparkle smoothly based on the camera move or orientation.

    For the moment I have a specular map that looks like some sparkles but it's not animated How can I do that ?

    The effect I am trying to create looks like this


    I found some informations but nothing seems to work. Any help is welcome !!

    Thanks a lot !
     
  2. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    This effect isn't animated.

    It's simply normal mapped and as the camera moves, the specular highlights move (as they would do on any model).
     
  3. MaT227

    MaT227

    Joined:
    Jul 3, 2012
    Posts:
    628
    Do you mean that there's two normal map ? One for the specular and one for the snow effect ?
     
  4. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    While the video is incredibly long-winded and hardly focuses on sparkles at all, I think what you're looking for is an environment map (reflective) shader, using random normals at points where there is high reflectivity. This might require two normal maps to prevent your snow from having lots of little normal mapped shadows, where you only want the random normals to be used for reflection. A surface shader should let you do this pretty easily.
     
    eneroth3 likes this.
  5. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    I've used a similar trick before on sand, get a noisy normal map (create a flat normal map, make noise that's not monochromatic, set to overlay, copy/paste all and normalise).

    Then use that as a detail normal map for when you're calculating spec.

    Works best if you disable mips and filtering on the detail normal map you've created - keeps it sharp and sparky but it can get a little noisy if you overdo it.
     
  6. Deleted User

    Deleted User

    Guest

    can someone please provide a shader code :) that will help to understand quickly :) .. or some more explained explination
     
  7. Deleted User

    Deleted User

    Guest

    by digging and research this post really helped me and at the end the result and setup was same as this page 22