Jump to content
• Advertisement

OpenGL Problem with metal effect?

This topic is 669 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Edited by paulgriffiths

Share this post

Share on other sites
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. :)

Edited by paulgriffiths

Share this post

Share on other sites

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

Share this post

Share on other sites

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

Edited by paulgriffiths

Share this post

Share on other sites

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:

Share this post

Share on other sites

Tried learnopgl.com's metal effect and did not like it, too depressing.

So from a mistake I created today I have created this:

Share this post

Share on other sites

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

Edited by paulgriffiths

Share this post

Share on other sites

• Advertisement
• Advertisement

• Popular Contributors

1. 1
2. 2
Rutin
18
3. 3
khawk
15
4. 4
A4L
14
5. 5
• Advertisement

• 10
• 13
• 26
• 10
• 11
• Forum Statistics

• Total Topics
633744
• Total Posts
3013666
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!