Jump to content
  • Advertisement
Sign in to follow this  
PlazmaInteractive

Weird visual glitch with custom Cook-Torrance shader

This topic is 415 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 already have a forum post in Unity's forum that contains most of the details and code regarding the problem I'm having so look at that one first.

So basically, I'm trying to write my own custom Cook-Torrance shader in Unity using Cg language. When I finished writing it up, the result shows a weird split halfway down the sphere where the first half looks correct and the second half being completely black. I don't know what's causing this weird visual glitch so I'm posting this here in case someone knows an answer.

I'm using Trowbridge-Reitz for Distribution, Schlick-GGX for Geometric and Schlick approximation for Fresnel.

You can see the result in the image below. The one after the image below is an image I found in this site that shows what I expected Cook-Torrance to look like.

Cook-Torrance.png

Specular.png

Edited by PlazmaInteractive

Share this post


Link to post
Share on other sites
Advertisement

You don't seem be multiplying the result by dot(n,l) at all.

N dot L isn't part of the diffuse or specular BRDF - it's part of the rendering equation itself (projection of a light ray onto an area of the surface) so must be done outside of every possible BRDF.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!