Hey @sebavan … I got a questions about Unity’s Material Options for Specular Highlights
When you have the material specular highlights options enabled in unity you get this extra glossiness or shininess.
With Specular Highlights Enabled:
With Specular Highlights Disabled:
My question is… Do you know what Unity is doing when enable specular highlights and do we have an equivalent option in BABYLON.PBRMaterial for specular highlights ???
Isn’t it simply our specular color? (like setting it to black will do the same as what you got on the 2nd example)
on the pbr material I guess you could use specularIntensity to reduce the specular impact.
So what color would i set specular and what specular intensity to to achieve that highlight effect ?
I assume it would be way over 1.0 for the specular intensity ???
I am not sure to understand. Is the toggle disabling specular or adding much of it in unity ?
to disable it, specularIntensity should be 0
to enable it you would set as usual metallic and roughness.
It looks like Unity is add extra highlighting if the toggle is true… If toggle is false… it looks just like babylon. I was trying to add the extra shiny highlight Unity is putting one. I dont see a specularColor property on PBRMaterial just specularIntensity and does not seem to have an effect.
I have the metallic roughness set to the values from Unity material editor (inverse smoothness of course) so i dont know what else i can set to achieve all that extra specular highlighting unity is doing here:
compared to this with the EXTRA specular highlighting disabled in unity:
This is probably an extra shader piece of code we do not support I would guess. Maybe you could make it work with nme.
I wonder what physical property it would map to ?
Adding @PatrickRyan in case he is got an idea here ?
@MackeyK24, I would love to take a look at this and see what it’s doing. Can you share the asset with me so I can compare apples to apples?
i mean the first is a screen shot from Unity show the standard material setup with an options selected called Specular Highlights that is producing all that extra shininess on the first image.
The second image is just a plane with that same texture. So i am not sure what want to compare apples to apples… I can send the texture i used to apply to the plane.
But the issues is trying to duplicate what unity calls Specular Highlights. The things that is adding that extra shininess to the materials
@MackeyK24, I wanted to use your base color and normal texture so I could set up a PG to validate what you were saying about Unity’s specular highlights checkbox. I quickly found a normal texture with some cracks to get something close. I also don’t know the specifics about your lighting setup in unity (position/direction of the directional light or what IBL you used) so I just set up a scene that is close. I skipped the environment light to illustrate, but it should work the same with an environment.
This is the PG I set up with two quads in it, the one on the left using PBRMaterial and the one on the right using the new PBR nodes in a node material. You can see that they both render the same and that there is a specular highlight on the quad from the directional light positioned as a backlight on the quad.
If you roll out the materials and select the “node” material, you will see a parameter bool called specularContribution which is enabled. If you toggle it off, you will see all of the specular highlights disappear on the right quad. This is basically what Unity is doing:
In the right quad, the node material is only passing the diffuse direct and diffuse indirect contributions with specularContribution set to false. If true, the shader adds in the specular direct and specular indirect contributions as well. Here is the node material graph that is implemented:
If you can repro in a PG the specular contribution not working like in Unity, I would be happy to look into that, but I am not seeing the behavior you are describing here.
1 Like
First of all, @PatrickRyan … That looks beautiful. The specular highlights look just like Unity.
Now… How the heck did you do that. I am not familiar with Node Material Editor (If that is what you are using).
I am using BABYLON.PBRMaterial via GLTF. I can customize PBRMaterial to add textures like reflectionTexture and lightmapTexture. But basically all meshes are GLTF meshes using GLTF PBR Materials.
How can i apply that specular highlights to my PBR Material ???
Worse case i could OVERRIDE the pbr.fragment.fx shader in the. shader store with a modified shader if that is possible…
But if i could that same specular highlighting on mt GLTF PBR Material… That would FREAKING SWEET
Yo @PatrickRyan … Im sorry i didnt read your response correctly the first time… I was distracted by how much better your specular highlights looks than mine does.
So are you saying IT SHOULD BE showing specular highlights already, by default ???
I have a directional light in the same exact position and rotation as the Unity Directional Light, so i dont see what else i could do with the light. But if i export to gltf i dont get the extra shininess at all
So i dont see what i am missing
Could it be anything to with a default color, like material.ambientColor (which is black by default in my Unity Export) ???
Yo @PatrickRyan … I created a playground that load the gltf scene with a directional light and IBL environment and Skybox… Same scene as Unity… Same position and direction of light with shadows.
But Unity Scene is WAY more shiny with specular highlights… I dont see the specular lighting at all in my GLTF export.
Desired Output, Like Unity (Screenshot)
Note: You may need to enable the Unity Toolkit on the Playground
Holy Crap, I think I got it… It turns out i had to setup my directional and ambient light with white specular color. It was defaulting to black
But that seems to do the trick. Check it out.
Unity With Specular Highlights DISABLED
And Babylon Version
Unity With Specular Highlights ENABLED
And Babylon Version
Looks like the Unity Version, down to the specular highlights
3 Likes