OpenGL 4 Shading Language Cookbook, Third Edition provides easy-to-follow recipes that first walk you through the theory and background behind each technique, and then proceed to showcase and explain the GLSL and OpenGL code needed to implement them.<br><br>The book begins by familiarizing you with
OpenGL 4 Shading Language Cookbook
β Scribed by David Wolff;
- Year
- 2018
- Tongue
- English
- Leaves
- 464
- Edition
- 3
- Category
- Library
No coin nor oath required. For personal study only.
β¦ Table of Contents
Cover
Title Page
Copyright and Credits
Packt Upsell
Contributors
Table of Contents
Preface
Chapter 1: Getting Started with GLSL
Introduction
GLSL
ProfilesΒ βΒ core versus compatibility
Using a loading library to access the latest OpenGL functionality
Getting ready
How to do it...
How it works...
There's more...
See also
Using GLM for mathematics
Getting ready
How to do it...
How it works...
There's more...
Using the GLM types as input to OpenGL
See also
Determining the GLSL and OpenGL version
How to do it...
How it works...
There's more...
Compiling a shader
Getting ready
How to do it...
How it works...
There's more...
Deleting a shader object
See also
Linking a shader program
Getting ready
How to do it...
How it works...
There's more...
Shader input/output variables
Deleting a shader program
See also
Saving and loading a shader binary
Getting ready
How to do it...
How it works...
See also
Loading aΒ SPIR-V shader program
Getting ready
How to do it...
How it works...
There's more...
See also
Chapter 2: Working with GLSL Programs
Introduction
Sending data to a shader using vertex attributes and vertex buffer objects
Getting ready
How to do it...
How it works...
There's more...
Separate attribute format
Fragment shader output
Specifying attribute indexes without using layout qualifiers
Using element arrays
Interleaved arrays
See also
Getting a list of active vertex input attributes and locations
Getting ready
How to do it...
How it works...
There's more...
See also
Sending data to a shader using uniform variables
Getting ready
How to do it...
How it works...
There's more...
See also
Getting a list of active uniform variables
Getting ready
How to do it...
How it works...
There's more...
See also
Using uniform blocks and uniform buffer objects
Getting ready
How to do it...
How it works...
There's more...
Using an instance name with a uniform block
Using layout qualifiers with uniform blocks
See also
Using program pipelines
Getting ready
How to do it...
How it works...
There's more...
See also
Getting debug messages
Getting ready
How to do it...
How it works...
There's more...
Building a C++ shader program class
Getting ready
How to do it...
How it works...
See also
Chapter 3: The Basics of GLSL Shaders
Introduction
Vertex and fragment shaders
Learning the basics first
Diffuse and per-vertex shading with a single point light source
Getting ready
How to do it...
How it works...
There's more...
See also
Implementing the Phong reflection model
Getting ready
How to do it...
How it works...
There's more...
Using a nonlocal viewer
Per-vertex versus per-fragment
Directional lights
Light attenuation with distance
See also
Using functions in shaders
Getting ready
How to do it...
How it works...
There's more...
The const qualifier
Function overloading
Passing arrays or structures to a function
See also
Implementing two-sided shading
Getting ready
How to do it...
How it works...
There's more...
Using two-sided rendering for debugging
See also
Implementing flat shading
How to do it...
How it works...
See also
Using subroutines to select shader functionality
Getting ready
How to do it...
How it works...
There's more...
See also
Discarding fragments to create a perforated look
Getting ready
How to do it...
How it works...
See also
Chapter 4: Lighting and Shading
Introduction
Shading with multiple positional lights
Getting ready
How to do it...
How it works...
See also
Shading with a directional light source
Getting ready
How to do it...
How it works...
There's more...
See also
Using per-fragment shading for improved realism
Getting ready
How to do it...
How it works...
There's more...
See also
The Blinn-Phong reflection model
Getting ready
How to do it...
How it works...
There's more...
See also
Simulating a spotlight
Getting ready
How to do it...
How it works...
See also
Creating a cartoon shading effect
Getting ready
How to do it...
How it works...
There's more...
See also
Simulating fog
Getting ready
How to do it...
How it works...
There's more...
Computing distance from the eye
See also
A physically-based reflection model
Getting ready
How to do it...
How it works...
There's more...
See also
Chapter 5: Using Textures
Introduction
Applying a 2D texture
Getting ready
How to do it...
How it works...
There's more...
Specifying the sampler binding within GLSL
See also
Applying multiple textures
Getting ready
How to do it...
How it works...
There's more...
See also
Using alpha maps to discard pixels
Getting ready
How to do it...
How it works...
There's more...
See also
Using normal maps
Getting ready
How to do it...
How it works...
See also
Parallax mapping
Getting ready
How to do it...
How it works...
There's more...
See also
Steep parallax mapping with self shadowing
Getting ready
How to do it...
How it works...
See also
Simulating reflection with cube maps
Getting ready
How to do it...
How it works...
There's more...
See also
Simulating refraction with cube maps
Getting ready
How to do it...
How it works...
There's more...
The Fresnel equations
Chromatic aberration
Refracting through both sides of the object
See also
Applying a projected texture
Getting ready
How to do it...
How it works...
There's more...
See also
Rendering to a texture
Getting ready
How to do it...
How it works...
There's more...
See also
Using sampler objects
Getting ready
How to do it...
How it works...
See also
Diffuse image-based lighting
Getting ready
How to do it...
How it works...
There's more...
See also
Chapter 6: Image Processing and Screen Space Techniques
Introduction
Applying an edge detection filter
Getting ready
How to do it...
How it works...
There's more...
Optimization techniques
See also
Applying a Gaussian blur filter
Getting ready
How to do it...
How it works...
There's more...
See also
Implementing HDR lighting with tone mapping
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a bloom effect
Getting ready
How to do it...
How it works...
There's more...
See also
Using gamma correction to improve image quality
How to do it...
How it works...
There's more...
See also
Using multisample anti-aliasing
Getting ready
How to do it...
How it works...
There's more...
See also
Using deferred shading
Getting ready
How to do it...
How it works...
There's more...
See also
Screen space ambient occlusion
Getting ready
How to do it...
How it works...
See also
Configuring the depth test
How to do it...
How it works...
See also
Implementing order-independent transparency
Getting ready
How to do it...
How it works...
There's more...
See also
Chapter 7: Using Geometry and Tessellation Shaders
Introduction
The shader pipeline extended
The geometry shader
The tessellation shaders
Point sprites with the geometry shader
Getting ready
How to do it...
How it works...
There's more...
See also
Drawing a wireframe on top of a shaded mesh
Getting ready
How to do it...
How it works...
There's more...
See also...
Drawing silhouette lines using the geometry shader
Getting ready
How to do it...
How it works...
There's more...
See also
Tessellating a curve
Getting ready
How to do it...
How it works...
There's more...
See also
Tessellating a 2D quad
Getting ready
How to do it...
How it works...
See also
Tessellating a 3D surface
Getting ready
How to do it...
How it works...
See also
Tessellating based on depth
Getting ready
How to do it...
How it works...
There's more...
See also
Chapter 8: Shadows
Introduction
Rendering shadows with shadow maps
Getting ready
How to do it...
How it works...
There's more...
Aliasing
Rendering back faces only for the shadow map
See also
Anti-aliasing shadow edges with PCF
Getting ready
How to do it...
How it works...
There's more...
See also
Creating soft shadow edges with random sampling
Getting ready
How to do it...
How it works...
There's more...
See also
Creating shadows using shadow volumes and the geometry shader
Getting ready
How to do it...
How it works...
There's more...
See also
Chapter 9: Using Noise in Shaders
Introduction
Creating a noise texture using GLM
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a seamless noise texture
Getting ready
How to do it...
How it works...
See also
Creating a cloud-like effect
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a wood-grain effect
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a disintegration effect
Getting ready
How to do it...
How it works...
See also
Creating a paint-spatter effect
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a rusted metal effect
Getting ready
How to do it...
How it works...
See also
Creating a night-vision effect
Getting ready
How to do it...
How it works...
There's more...
See also
Chapter 10: Particle Systems and Animation
Introduction
Animating a surface with vertex displacement
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a particle fountain
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a particle system using transform feedback
Getting ready
How to do it...
How it works...
There's more...
Using layout qualifiers
Querying transform feedback results
See also
Creating a particle system using instanced meshes
Getting ready
How to do it...
How it works...
There's more...
See also
Simulating fire with particles
Getting ready
How to do it...
How it works...
There's more...
See also
Simulating smoke with particles
Getting ready
How to do it...
How it works...
See also
Chapter 11: Using Compute Shaders
Introduction
Compute space and work groups
Executing the compute shader
Implementing a particle simulation with the compute shader
Getting ready
How to do it...
How it works...
See also
Creating a fractal texture using the compute shader
Getting ready
How to do it...
How it works...
There's more...
See also
Using the compute shader for cloth simulation
Getting ready
How to do it...
How it works...
There's more...
See also
Implementing an edge detection filter with the compute shader
Getting ready
How to do it...
How it works...
There's more...
See also
Other Books You May Enjoy
Index
π SIMILAR VOLUMES
<p> Acquiring the skills of OpenGL Shading Language is so much easier with this cookbook. You'll be creating graphics rather than learning theory, gaining a high level of capability in modern 3D programming along the way. </p> <p><b>Overview</b></p> <ul> <li>Discover simple and advanced techniques
<p> Acquiring the skills of OpenGL Shading Language is so much easier with this cookbook. You'll be creating graphics rather than learning theory, gaining a high level of capability in modern 3D programming along the way. </p> <p><b>Overview</b></p> <ul> <li>Discover simple and advanced techniques
The OpenGL Shading Language (GLSL) Version 4.0 brings unprecedented power and flexibility to programmers interested in creating modern, interactive, graphical programs. It allows us to harness the power of modern Graphics Processing Units (GPUs) in a straightforward way by providing a simple, yet po
With over 60 recipes, this Cookbook will teach you both the elementary and finer points of the OpenGL Shading Language, and get you familiar with the specific features of GLSL 4.0. A totally practical, hands-on guide. Overview A full set of recipes demonstrating simple and advanced techniques for pr
<p>Over 60 highly focused, practical recipes to maximize your OpenGL Shading language use</p> <ul> <li>A full set of recipes demonstrating simple and advanced techniques for producing high-quality, real-time 3D graphics using GLSL 4.0</li> <li>How to use the OpenGL Shading Language to implement ligh