Problem with metal effect?

Started by
6 comments, last by Paul Griffiths 7 years, 2 months ago

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?


problem.jpg

Advertisement

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. :)

problem.jpg

Problem is theres too much chrome and not enough color. Any ideas?

Got more color now, do you see anything wrong or what could be improved?


problem.jpg

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:

problem.jpg

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:

problem.jpg

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?!

This topic is closed to new replies.

Advertisement