Getting ready

Start with the code presented in the Rendering shadows with shadow maps recipe. There are three additional uniforms that need to be set. They are as follows:

  • OffsetTexSize: This gives the width, height, and depth of the offset texture. Note that the depth is same as the number of samples per fragment divided by two.
  • OffsetTex: This is a handle to the texture unit containing the offset texture.
  • Radius: This is the blur radius in pixels divided by the size of the shadow map texture (assuming a square shadow map). This could be considered as the softness of the shadow.

Get OpenGL 4 Shading Language Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.