Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

How to make a light only emits speculars ?

Discussion in 'General Graphics' started by g.bergere, Dec 15, 2014.

  1. g.bergere

    g.bergere

    Joined:
    Dec 15, 2014
    Posts:
    2
    Hello !

    I'm trying to find a way to make so that my 3d mesh is only lit by specular light, and reflects no diffuse light at all.
    I have a specular map in the alpha channel of a specular shader, and i want that the light only interacts with the white zones of this texture. So far, I did not manage to avoid my light also illuminates the mesh in the black zones of this texture.
    I know there is an option in Maya lights to separate diffuse and specular emmision, and to disable independently one or the other one.
    Is there a method to do the same in Unity ? Or maybe someone knows how to solve my problem in other way ?
     
  2. GixG17

    GixG17

    Joined:
    Aug 18, 2013
    Posts:
    105
    To my understanding, your best bet is to build your own shader that only picks up the specular.
     
  3. g.bergere

    g.bergere

    Joined:
    Dec 15, 2014
    Posts:
    2
    Hey !
    Thank you for your quite answer GixG17.

    I'm just begining in Unity, and I know nothing about scripting custom shader or anything else. If you have in mind a precise idea of how only picks up the specular in a custom shader, could you guide me a little ?

    So that you can have all informations if you want to guide me, I'll specify exactly what I'm trying to get :

    I'm working to obtain a painterly CG render in Unity. So, I created a painterly color texture for my 3D mesh. To get as closer as possible to a painting, I painted directly the diffusion and occlusion shadows on this texture, to not use these CG render shadows.
    So I choosed to use the "Self-Illumin" shader with this texture, 'cause it generates no diffusion shadows at all (the mesh appears at his full color, whatever its angle with the camera or the ambient-light).
    Then I created a black&white map with brushes strokes, and I want that a 3D light lights the mesh only in the white areas, and let the black areas unlit. So I thought that use this map as a specular map would be a good solution, by turning off the diffuse light. But maybe someone knows a better way ?