Hi!
I can’t find a way to disable direct specular impact from real-time lights on a per-object / per-material basis. I can globally disable it either by toggling it off in the HDRP settings or in the light component settings. But that obviously disables it for everything.
If I turn down the smoothness value on the standard lit material to 0 then there’s still a lot of specular lighting left:
If I set the material type to Specular and also turn down the specular value all the way down to the pure black, there’ still some specular response, but its way better.
I know that it’s not physically correct, because “everything has fresnel” and other stuff, probably, but I want to provide my own specular lighting response for certain objects. And if it will be overlaid on top of the existing stubborn real-time specular, it will also be incorrect.
Hey, you can probably use a reflection probe with a custom black reflection map. And use the light layer system to only affect these specific objects. This way they will receive no reflections.
Unfortunately, reflection probes don’t affect/override the direct specular that comes from real-time lights. A custom pure-black reflection probe disables only itself…
I thought that maybe I can render the direct specular component into a rendertexture with the help of AOV somehow, but I was told in the other thread that it’s not possible without performance impact.
You can still use the light layer system to prevent this.
Here’s a test where I set all the objects on a given layer to not receive any reflection. The bronze ball is entirely black as a result:
And if you use a black reflection probe like I mentioned above, you can kill the reflection. The probe doesn’t disable itself like you mentioned.
In the example below, it does indeed receive direct specular from nearby lights, but again, you can use the light layer system to prevent nearby lights from affecting this particular object.
You can tell the lights to not affect the layer the ball is on, and you get zero influence from the nearby black probe nor from the spotlight above as a result. And if you don’t want the black probe to affect other objects than the sphere, again the light layer system comes to the rescue.
Thanks for the detailed explanation, and I’m sorry if I get it wrong, but that’s exactly the issue. I don’t want to prevent the lights from affecting the objects completely. I want them to affect albedo, normals, provide shadows, etc. and the only thing that I want to exclude is the direct specular component. It’s like if the “affect specular” option wasn’t an off/on the switch, but rather a layer selection:
In other words, I need “affect specular” disabled for certain objects, while “affect diffuse” and the rest of the light impact enabled for all objects.
You could duplicate some lights in this room, set them to only affect the “no specular” light layer that you create, and then set them to not “Affect Specular”. Then all objects you add to the “no specular” light layer won’t receive specular from said lights.
It requires some duplication, but in the end, you can separate entirely the “normal lights” from the “no specular lights” easily. And if your lights are in a prefab, it’s just a matter of having another prefab instance of the same light, with 1 override only on the “Affect Specular” property.
This is something that you would have to profile for yourself. If it’s just a few lights, it might be imperceptible. If it’s several dozens, there might be a cost. The pixel shading pass might even be cheaper.
This is hilarious. Im sorry you cant get good help OP. I would just set the reflection probe usage to OFF for the mesh renderer. Now when you put the smoothness to 0 there will be no light shine at all.
Also, when you set a material type to specular (versus metallic), all you are doing is aenabling a specular map for the shader. This is a map that only affect the Color of the specular shine, thats it.