flutter3d_shaders

The engine's shader sources, in GLSL, for every backend to compile.

There is one shared copy so that backends cannot drift apart: flutter3d_impeller builds them into a flutter_gpu bundle, flutter3d_webgl translates them to GLSL ES 3.00, and flutter3d_cpu implements the same stages in Dart against the same declarations.

A shader that exists in one backend and not the others gives a picture that differs by platform, and nothing notices. This has happened: the sky was rewritten here while the browser's copy of the table was a year out of date, so two backends drew different skies until a generated file was finally diffed.


Part of flutter3d, an independent implementation of a 3D engine for Flutter. It is not a fork or a binding of another engine, and it is not affiliated with Google or the Flutter project. It has four switchable rendering backends: Impeller via Flutter GPU, WebGL2, WebGPU and a software rasteriser. It loads glTF, OBJ and .f3d, and has six lighting models, shadows, bloom, skinning, animation, BVH culling and picking, plus a deterministic fixed-step game layer with collision, navigation, positional audio, and gamepad and touch input. Four example games (shooter, platformer, racing, strategy) are each built on a genre package: flutter3d_game_shooter, flutter3d_game_platformer, flutter3d_game_racing, flutter3d_game_strategy. A new game starts from the editor's scaffold, which writes one from a template: flutter3d.pleion.dev/first-project/. Documentation: flutter3d.pleion.dev.

Libraries

backend
The shader contract a backend is written against (D27): what the engine's stages bind, how the engine's uniform blocks are laid out, how a backend compiles the material language, and the check that a pipeline's stages agree.
compile
Everything translate.dart has, and the half that needs a machine: the engine's sources read off disk, glslang and naga run as processes, and a bundle's varyings numbered against the engine's.
flutter3d_shaders
What the engine asks a backend's bundle for, readable from Dart.
internal
What the engine's renderer (flutter3d_core) reads about the shaders: a typed block per uniform struct (FrameInfoBlock and the rest). No backend imports it: which blocks and samplers each stage binds, and every block's layout, are the backend author's contract in package:flutter3d_shaders/backend.dart.
kernel
Compute kernels written in the kernel language, read once and translated for each placement: WGSL for WebGPU and the wgpu sidecar, a Dart kernel for the CPU — 1.0.
translate
The engine's GLSL in the dialects the web backends read: GLSL ES 3.00 for WebGL2, and the prepared GLSL and reflection WebGPU's section is made of.