BasicEffect uses the standard Blinn-Phong shading model, which combines both diffuse and specular light.

Tweaking the diffuse part is pretty easy. Just set the BasicEffect.DiffuseColor property to the color of your object, or to white if your model is textured, and you're done.

Here is a model illuminated only by only diffuse light:

Specular light can be harder to understand. When viewed in isolation, its contribution seems incredibly minimal:

But in combination with the diffuse light, specular is a critical part of making a model look good. Set it too low, and your objects will appear flat and uninteresting. Too high, and everything will look like plastic: waxy and unnatural.

So how do you tweak specular?

BasicEffect.SpecularColor should almost always be monochrome. Brighter whites increase the overall amount of specularity, while darker grays make it more subtle.

BasicEffect.SpecularPower is the more important property. This controls the focus of the specular highlight. Smaller values produce a softer, more blurred highlight, while higher settings give a smaller and tighter glint.

Here is the character model rendered using SpecularPower = 4:


This is using SpecularPower = 16:


And finally with SpecularPower = 64:

Makes quite a difference, huh? The higher specular power looks silly on the skin, but I like how the more focused glints accentuate the shape of the leggings and that wrist armor thingie.

A single specular power will rarely look good for all the surfaces which make up a model. You will usually need several different materials, each with different specular settings, to get good results.

Fortunately, both the .FBX and .X model formats support specular power as part of their standard material data, so you can set up as many materials as you like in your modeling program, and the content pipeline will bring these settings through into the game for you.

If you are writing your own shaders rather than using BasicEffect, you might want to consider using a separate texture, or perhaps the alpha channel of your main texture, to control the specular amount and power. That way you can tweak these settings differently for every single pixel, rather than just changing them from one material to another.

Comments (3)

  1. JoelMartinez says:

    This is an awesome set of articles you’ve been writing.  For people that are just getting into it, understanding how all the different elements contribute to the final render can be tough.  Putting up screenies of something under different conditions is awesome.

  2. Nick T. says:

    Thanks for posting this article and the example pics! The great explanation of Specular Power helped me relay the artistic merits to some of our programmers, in order to convince them to add this feature to our engine.

  3. BrianS says:

    I’m just starting to work on a game with a cartoony look to it, and I was just despairing that my models looked a bit dull. This fixed my problem spectacularly! 🙂

    My models have a duplicate, larger black mesh with inverted normals to give them a cartoony outline, so I had to play with things a bit to keep the black lines looking black, but I’m quite happy with the results.

Skip to main content