Jump to content
  • Advertisement
  • entries
  • comments
  • views

Cook-Torrance Results

Sign in to follow this  


Above: Identical data for all 3 spheres. Left-most is Blinn-Phong, middle is Ward and right-most is Cook-Torrance.

If you look closely at the above image I've got some pixel distortion going on. Only appeared since I've been using Nvidia hardware - guess it's that damned Directly Mapping Texels to Pixels malarky. A recent thread in DX pointed out that ATI and Nvidia handle this differently, hence it looked fine on my previous setup

EDIT: Fixed this now. click here for a 350kb image showing the difference getting texels-to-pixels correct can make. Image is a before and after shot with a difference in the middle - where you can quite clearly see the artifacts [oh]

Dropped in the Cook Torrance model this morning, wasn't too bad. My hard-coded test results were much better than the above image - but the final model must be data driven rather than hard coded. I guess another example of where my programmer-art skills get in the way [sad]

I managed to find a mistake in Advanced Lighting and Materials with Shaders (one of my 3 recommended books). On page 154, second column it has a code fragment:

float3 G1 = 2 * NdotH * NdotV / NdotH;
float3 G2 = 2 * NdotH * NdotL / NdotH;

The denominators in both those lines should be VdotH. The mathematical representation on page 104 agrees with my other resources and also confirms that the code fragment is wrong.

I don't know if the sample code has the same mistake, but it did make a noticeable difference to the results once I corrected it [oh]
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

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!