Point Light: Per Fragment

Fragment Shader Processes Lighting

Swipe to Spin the Cube

The fragment shader calculates lighting. The cube is mapped with a solid color green. Lighting helps define the shape of the cube. Light location, light color, and ambient color are all declared with constants in the vertex shader, to keep this example simple.

Compare to point lighting within the vertex shader, tap the link below. Read the point light tutorial for details.

As the cube spins and moves, both a model matrix and a normal matrix are uploaded. The vertex shader uses the normal attributes and normal matrix to compute lighting per frame. See the per vertex shader Point Light Tutorial with source code. The per vertex point light shader uses similar functionality, however the vertex shader accomplishes most of the light calculations.

3D Models

If a picture's worth a thousand words, then a 3D model's worth ten thousand words! Consider 3D interactive content for learning, media, and marketing. Seven Thunder Software develops 3D models for Web design, with optimized (fast loading) 3D rendering software, from photographs, blue prints, ideas, and real objects.

Tags

Interactive media, 3D shapes, 3D models, 3D, online 3D modeling,3D viewer, Web GL, 3D Programming, 3D Development, 3D Media, 3D Web, GLSL, 3D Web Design, 3D Web Development, Web development, create 3D website, 3D Media, 3D animation, graphic design, Website design,
Learn 3D Programming Learn 3D Programming
Copyright © 2015 Seven Thunder Software. All Rights Reserved.