Google Filament: Difference between revisions

From David's Wiki
No edit summary
 
Line 19: Line 19:


===Fragment shader===
===Fragment shader===
The fragment shader expects the output to be in premultiplied alpha.

Latest revision as of 04:33, 12 March 2025

Notes on using Filament, the rendering engine for many Google applications.

Note that Filament is not a replacement for Unity or Godot.

Types

Materials

In filament, shaders are written as materials. The documentation for materials is available at https://google.github.io/filament/Materials.html

Vertex shader

Unlike standard OpenGL shaders, you cannot output arbitrary positions in the vertex shader.

You can: 1. Modify the world position of the vertices. 2. Send interpolants, aka varyings, to the pixel shader. 3. Use a custom 4x4 matrix to transform coordinates from local to clip space.

Fragment shader

The fragment shader expects the output to be in premultiplied alpha.