Search Unity

Question Light that does not produce specular highlights on an otherwise specular material?

Discussion in 'Global Illumination' started by igarrickbeth, Jan 23, 2022.

  1. igarrickbeth

    igarrickbeth

    Joined:
    Sep 22, 2020
    Posts:
    18
    Hello,

    I'm trying to add some diffuse light to an object (in addition to the ambient light). The object's material allows specular highlights using the built-in render pipeline standard specular shader. However, I want the diffuse light to NOT show a specular highlight, while all other light sources should show a specular highlight on the object. Furthermore, I cannot bake the diffuse light because the diffuse light changes in time.

    Would be most grateful for any suggestions!!
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    You have two options:
    1. Use baked lights. They will not contribute realtime direct specular to shiny materials
    2. Select the material in question, and uncheck Specular Highlights option. This works only when using Forward Rendering path
     
  3. igarrickbeth

    igarrickbeth

    Joined:
    Sep 22, 2020
    Posts:
    18
    Thanks very much for your suggestions. However, the problem is that we need mixed behavior from different lights on the same material: some lights should have specular reflections, other lights should not have specular reflections, and some should show both specular and diffuse light. Is this possible? Unfortunately, I cannot use baked lights because all lights are changing in real time.

    Thanks again!!
     
  4. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    In that case, refer to my second suggestion. You'd still be able to use mixed lights, and remove specular highlights for select materials.

    Screen Shot 2022-01-26 at 10.06.04.png
     
  5. igarrickbeth

    igarrickbeth

    Joined:
    Sep 22, 2020
    Posts:
    18
    Thank you again! But it is possible to have this effect on ONE single material?

    Thanks!
     
  6. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Yes, obviously. Just create a new material (or a material instance if you are using URP).
     
  7. Max-om

    Max-om

    Joined:
    Aug 9, 2017
    Posts:
    499
    Why do you not want specular highlights? That's physical correct. Sounds like your PBR material needs work?
     
  8. igarrickbeth

    igarrickbeth

    Joined:
    Sep 22, 2020
    Posts:
    18
    Thanks very much for the replies! I really do appreciate your help.

    The screenshot clarifies my problem (I hope! :) ). The example shows the sun and an ambient light hitting the earth: on land and water. The sun works well - diffuse light on the land and specular on the water.

    But I also need an ambient skybox-like light. But I need more control than a skybox in terms of the layers it affects. So I am not using the skybox. But I don't want this ambient light to show specular highlights because it is not a physical light. Is there a way to control the specular behavior of a single light and remove the white specular effect shown below, while keeping the sun effect the same, and keeping the ambient light's diffuse white light on the land?

    Thanks again!
    specular_notes_jan30b.png
     
    Last edited: Jan 31, 2022
  9. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Override the Ambient Lighting mode to Color, and set the color to pure black. That would actually make more sense, given that there's no ambient light in the darkness of space. For ambient lighting, you'd have to write a custom shader.
     
  10. igarrickbeth

    igarrickbeth

    Joined:
    Sep 22, 2020
    Posts:
    18
    Yes, I have already set the Ambient Lighting mode to color/black, glad to hear I'm on the same page!

    But I do need some additional subtle lights. So it looks like I will probably go down the shader path.

    Thank you!