O'Reilly logo

OpenGL ES 3.0 Cookbook by Parminder Singh

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

Phong shading – the per-fragment shading technique

This shading technique is also called as smooth shading. In this recipe, we will implement Phong shading, which is a per-fragment illumination technique. Using the per-fragment technique, light shadings add more realism to the rendering scene in comparison to the per-vertex technique. We will compare Gouraud shading with Phong shading to see the relative difference between the two techniques.

In Phong shading, color intensities are directly calculated within the fragment shader with the help of light and material properties. The vertex shader is responsible for calculating the normal and vertex position in the eye coordinates; these variables are then passed on to the fragment shader. The vertex ...

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