Effects
The four examples the gallery lists under Effects. Each block is what the gallery’s code panel shows beside that example, copied from the example itself: the lines that do it rather than the whole file, so it isn’t compiled here the way the guides’ code is. The file it came from is linked under each one.
Post-processing
Section titled “Post-processing”Bloom, depth of field, occlusion, grading and anti-aliasing, over a scene bright enough to show each of them.
// Everything after the scene is drawn, on the scene rather than the camera:// a look belongs to the place, not to where somebody is standing in it.OrblitScene( objects: objects, camera: camera, post: OrblitPostProcess( bloom: OrblitBloom(enabled: true, strength: 0.25, lensFlare: true), occlusion: OrblitOcclusion(enabled: true), depthOfField: OrblitDepthOfField(enabled: true, focusDistance: 12), grading: OrblitGrading( enabled: true, toneMapping: ToneMapping.aces, exposure: 0.4, saturation: 1.1, ), ),);From post.dart. To open the gallery on it:
ORBLIT_EXAMPLE='post-processing' flutter run -d macosMotion blur
Section titled “Motion blur”A spinning fan and a sliding block smeared by their own motion while the wall behind them stays sharp, at a shutter you choose.
// The world into a target that keeps its depth, and the blur from there onto// the screen. The shutter follows the camera's own unless one is given.OrblitScene( camera: camera.copyWith(shutterSpeed: 1 / 30), graph: const OrblitMotionBlur().graph(), // ...)
// Or as one pass in a graph of your own, reading a target with depth.const OrblitMotionBlur(maxPixels: 32, objects: false) .pass(reads: 'frame', into: 'blurred')From motion_blur.dart. To open the gallery on it:
ORBLIT_EXAMPLE='motion blur' flutter run -d macosDistortion
Section titled “Distortion”A shockwave across a chequered floor, heat rising off a vent, and a lens warping the lot.
// Distortions are part of the scene, like its lights. The renderer sums// them in one pass over the finished frame — and draws no pass at all// when none of them is moving anything.OrblitScene( distortions: [ OrblitDistortion.expanding( centre: blast, age: seconds - wentOffAt, // the host's clock speed: 3.5, chromatic: 0.3, ), OrblitDistortion.haze( centre: vent + Vector3(0, 1.6, 0), halfSize: Vector3(0.9, 1.6, 0.9), seconds: seconds, ), OrblitDistortion.lens(strength: 0.1), // barrel; negative is pincushion ], ...)From distortion.dart. To open the gallery on it:
ORBLIT_EXAMPLE='distortion' flutter run -d macosOutline
Section titled “Outline”A selection outline that follows the silhouette, and still finds an object hidden behind a wall.
// The outline is on the scene, not on the objects: it is about how the// world is being looked at, and an editor changes it on every click// without touching a single object.OrblitScene( objects: objects, camera: camera, outline: OrblitOutline( // The active object, in the lighter orange. primary: behindTheWall.key, // Everything else selected, in the deeper one. keys: {besideIt.key}, width: 3, // What the wall hides is still outlined — fainter, and dashed, so it // reads as behind rather than in front. occluded: OrblitOccluded.dashed, ),)
// Colours are Flutter Colors — display colours — because the outline is// drawn after tone mapping and lands on screen as exactly what was asked// for. OrblitOutline.none, the default, draws nothing and costs nothing.From outline.dart. To open the gallery on it:
ORBLIT_EXAMPLE='outline' flutter run -d macos