O'Reilly logo

Mastering SFML Game Development by Raimondas Pupius

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Specular maps

While normal maps provide us with the possibility of faking how bumpy a surface is, specular maps allow us to do the same with the shininess of a surface. This is what the same segment of the tile sheet we used as an example for a normal map looks like in a specular map:

Specular maps

It's not as complex as a normal map, since it only needs to store one value: the shininess factor. We can leave it up to each light to decide how much shine it will cast upon the scenery by letting it have its own values:

struct LightBase { 
  ... 
  float m_specularExponent = 10.f; 
  float m_specularStrength = 1.f; 
}; 

Adding support for specularity

Similar to normal maps, we ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required