Compositing Shaders in X3D

Michalis Kamburelis

Cellular texturing using our procedural texture

Ph.D. Thesis

Institute of Computer Science
University of Wrocław

Wrocław, 2011

You can redistribute and/or modify this document under the terms of the GNU General Public License as published by the Free Software Foundation. Either version 2 of the License, or (at your option) any later version. The license text may be found on

Table of Contents

1. Overview
2. What is X3D?
3. Shaders and X3D
4. Motivation and previous work
5. Extending the shaders with plugs
5.1. Effect node
5.2. Effects for particular shapes
5.3. Effects for a group of nodes
5.4. Light sources effects
5.5. Texture effects
5.5.1. Procedural textures
5.5.2. Example of a procedural texture
5.5.3. When to use the ShaderTexture
5.5.4. Texture resolution does not matter
6. Extensions for geometry shaders
6.1. Robust geometry shaders
6.2. Effects that cooperate with geometry shaders
7. Defining custom plugs
7.1. Forward declarations
7.2. Invalid shader code
8. Examples
9. Implementation
9.1. Outline of the implementation
9.1.1. Helper functions
9.1.2. Final algorithm
9.2. Correct shadows from multiple light sources
9.3. Pool of shaders
9.4. Speed
9.5. Inspect shaders generated by our implementation
10. Conclusion
A. Reference of available plugs
A.1. Vertex shader plugs
A.2. Fragment shader plugs
A.3. Lights plugs (internal; at vertex or fragment shader)
A.4. Geometry shader plugs

List of Figures

1.1. Japanese shrine model with more and more effects applied
5.1. Toon and Fresnel effects combined
5.2. Volumetric fog with animated density
5.3. Textured spot light with shadow
5.4. Cellular texturing
5.5. ShaderTexture doing an edge detection operation on a normal ImageTexture
5.6. Texture effects are not concerned with the texture resolution
6.1. Converting mesh into a dense line and point sets by geometry shaders
8.1. ElevationGrid with 3 textures mixed (based on the point height) inside the shader
8.2. 3D and 2D smooth noise on GPU, wrapped in a ShaderTexture
8.3. Water using our effects framework
8.4. Flowers bending under the wind, transformed on GPU in object space