Jump to content
  • Advertisement
Sign in to follow this  
JMab

Specular Maps - I'm doing it wrong

This topic is 1523 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

Hi D3D experts,

 

I've recently tried to move from a single specular intensity value to using a specular map, and it doesn't look good.

 

This is what a single specular intensity value looks like:

 

OldSpecular.jpg?dl=0

 

Pretty smooth, as you'd expect. This is what it looks like after I try and control the specular intensity with a specular map:

 

NewSpecular.jpg?dl=0

 

Not good. Here's what the specular map looks like:

 

SpecularMap.jpg?dl=0

 

And here's my HLSL (old code commented out). Specular color was sampled from the specular map. I just noticed that I needlessly sample into a float3 and then just use the x value, but I think that makes no difference:

// Blinn specular.
toEye = normalize(toEye);
float3 halfway = normalize(toEye + toLight);
float nDotH = saturate(dot(halfway, material.Normal));
//finalColor += pow(nDotH, material.SpecularPower) * material.SpecularIntensity;
finalColor += pow(nDotH, material.SpecularPower) * material.SpecularColor.x;

Any way I can get smooth specular highlights again whilst gaining the ability to only apply the highlights to certain parts of the textured model?

 

Share this post


Link to post
Share on other sites
Advertisement

Do you have mipmaps and bilinear filtering enabled for your specular map?

Share this post


Link to post
Share on other sites

Bilinear filtering yes, mipmaps no! When I started generating specular maps in ShaderMap2 I was remembering to generate mipmaps in the DX Tex Tool, but I'd forgotten that step recently. Generating mipmaps for the specular map solved the problem!

 

Thanks very much MJP, much appreciated.

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.

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!