Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
OpenGL 4 Shading Language Cookbook

You're reading from   OpenGL 4 Shading Language Cookbook Build high-quality, real-time 3D graphics with OpenGL 4.6, GLSL 4.6 and C++17

Arrow left icon
Product type Paperback
Published in Sep 2018
Publisher Packt
ISBN-13 9781789342253
Length 472 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
David A Wolff David A Wolff
Author Profile Icon David A Wolff
David A Wolff
David Wolff David Wolff
Author Profile Icon David Wolff
David Wolff
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Getting Started with GLSL FREE CHAPTER 2. Working with GLSL Programs 3. The Basics of GLSL Shaders 4. Lighting and Shading 5. Using Textures 6. Image Processing and Screen Space Techniques 7. Using Geometry and Tessellation Shaders 8. Shadows 9. Using Noise in Shaders 10. Particle Systems and Animation 11. Using Compute Shaders 12. Other Books You May Enjoy

What this book covers

Chapter 1, Getting Started with GLSL, explains the steps needed to compile, link, and use GLSL shaders within an OpenGL program. It also covers how to save and load shader binaries, and how to use SPIR-V with OpenGL. It covers the use of the GLM library for mathematics support.

Chapter 2Working with GLSL Programs, introduces the basic of communication between the shader programs and the OpenGL program. It covers how to send data to shaders using attributes and uniform variables, how to enumerate variables, how to work with shader pipelines, and offers an example of a shader program class.

Chapter 3, The Basics of GLSL Shaders, introduces you to the basics of GLSL programming with per-vertex shading. In this chapter, you see examples of basic shading techniques such as the Phong model, two-sided shading, and flat shading. It also covers examples of basic GLSL concepts such as functions and subroutines.

Chapter 4, Lighting and Shading, continues with basic shading techniques, with a focus on the fragment shader. It introduces you to techniques such as the Blinn-Phong model, spotlights, per-fragment shading, toon shading, fog, and a physically based reflection model. 

Chapter 5, Using Textures, provides a variety recipes involving the use of textures in GLSL shaders. Textures can be used for a variety of purposes besides simply "pasting" an image onto a surface. In this chapter, we cover the basic application of one or more 2D textures, as well as a variety of other techniques including alpha maps, normal maps, parallax mapping, cube maps, projected textures, rendering to a texture, and diffuse image based lighting. We also cover sampler objects, a relatively new feature that decouples sampling parameters from the texture object itself.

Chapter 6, Image Processing and Screen Space Techniques, explains common techniques for the post-processing of rendered images and some other screen-space techniques. Image post-processing is becoming a crucially important part of modern game engines and other rendering pipelines. This chapter discusses how to implement some of the more common post-processing techniques such as tone mapping, bloom, blur, gamma correction, and edge detection. We also cover some screen-space rendering techniques such as deferred shading, multisample anti-aliasing, screen-space ambient occlusion, and order-independent transparency.

Chapter 7, Using Geometry and Tessellation Shaders, covers techniques that demonstrate how to use these powerful shader stages. After reading this chapter, you should be comfortable with their basic functionality and understand how to use them. We cover techniques such as geometry-shader-generated point sprites, silhouette lines, depth-based tessellation, Bezier surfaces, and more.

Chapter 8, Shadows, introduces basic techniques for producing real-time shadows. This chapter includes recipes for the two most common shadow techniques: shadow maps and shadow volumes. We cover common techniques for anti-aliasing shadow maps, as well as how to use the geometry shader to help produce shadow volumes. 

Chapter 9, Using Noise in Shaders, covers the use of Perlin noise for creating various effects. The first recipe shows you how to create a wide variety of textures containing noise data using GLM (a powerful mathematics library). Then we move on to recipes that use noise textures for creating a number of effects such as wood grain, clouds, disintegration, paint, and static.

Chapter 10, Particle Systems and Animation, focuses on techniques for creating particle systems. We see how to create a particle system to simulate fire, smoke, and water. We also make use of the OpenGL feature called transform feedback, in order to gain additional efficiency by moving the particle updates onto the GPU.

Chapter 11, Using Compute Shaders, introduces you to several techniques that make use of one of the newest features in OpenGL, the compute shader. The compute shader provides us with the ability to do general computation on the GPU within OpenGL. In this chapter, we discuss how to use the compute shader for particle simulations, cloth simulation, edge detection, and the generation of a procedural fractal texture. After reading this chapter, the reader should have a good feel for how to use the compute shader for arbitrary computational tasks.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image