I'm using the following shaders, problem is half the screen is always black and it follows the camera.
I'm using a deferred renderer.
It's a mixture of code from http://ruh.li/GraphicsCookTorrance.html and learnopengl.com
Any ideas?
I'm using the following shaders, problem is half the screen is always black and it follows the camera.
I'm using a deferred renderer.
It's a mixture of code from http://ruh.li/GraphicsCookTorrance.html and learnopengl.com
Any ideas?
Solved it changed spec to:
// Specular shading
vec3 reflectDir = reflect(-lightDir, normal);
float spec = pow(max(dot(viewDir, reflectDir), 0.0), 1.0) * (fresnel * geoAtt * roughness) / (NdotV * diff * 3.14);
Only understand a little bit of the maths but got it working. :)
I don't think the code is for metal, because I had it wrong I thought it was, though I like it so ill probably use some of it.
Here's what I have now:
learnopengl.com has advanced code for metal: https://learnopengl.com/#!PBR/Theory
But what I didn't know is that code is available too: https://github.com/JoeyDeVries/LearnOpenGL/tree/master/src/6.pbr
Now I'm happy :)
Tried learnopgl.com's metal effect and did not like it, too depressing.
So from a mistake I created today I have created this:
Here's what I currently have:
vec3 CalcMetalPointLight(Light light, vec3 normal, vec3 fragPos, vec3 viewDir, vec3 Diffuse, float Specular, float Shadow)
{float spec = pow(max(dot(viewDir, reflectDir), 0.0), 1.0) * (fresnel * geoAtt * roughness) / (NdotV * diff * 3.14);
}
// Attenuation
float distance = length(light.Position - fragPos);
float attenuation =
I think if I mix this with a cubemap then Ill have something pretty good?!