Hey everyone. I’ve been learning how to write shaders using the Cg language and finally decided to tackle the concept of PBR. Using this video and some slight modifications, I was able to create one but there was an issue that I’m not able to fix yet.
In my shader, the material goes completely black if the roughness is at 1 while metallic is also at 1 even though that should only happen when the roughness is 0 (a perfect mirror essentially). However, this isn’t the case with mine and the material is black even though the roughness is at max value. Here’s a comparison with Unity’s standard shader:
Theirs uses a smoothness value which is basically the opposite to my roughness value. As you can see, when their smoothness value is 0 (rough material), the material is darkened rather than going completely black. Also, because of this, my material stays black when the metallic value is at 1 even though I lower my roughness value. The lower the roughness value, the intense the specular highlight should appear until it reaches 0 which would be black.
If anyone know how to solve this, let me know. Here’s the code.