Skip to content

flutter_scene 0.21.0

Choose a tag to compare

@bdero bdero released this 17 Aug 23:29
  • Requires Flutter 3.47.0 or newer. That is the first stable carrying the Flutter GPU support this package needs, so the constraint is a real minimum rather than the loose value earlier releases carried. A master build numbered 3.47.0-1.0.pre.N sorts below it and will not resolve.
  • Assets are generated into flutter_scene_generated/ at the app root and loaded by source path, the same way on every Flutter channel. dart run flutter_scene:init installs the hook, creates the directory with a .gitignore for its outputs, and adds the one pubspec assets entry it needs.
  • flutter pub add flutter_scene is the whole setup. flutter_scene's own build hook compiles the engine's shaders for the app being built, on every channel, so an app with no hook of its own renders a runtime-imported .glb everywhere including web.
  • Compiled shader bundles record the engine that built them and are rebuilt when it changes, so switching Flutter versions cannot leave a bundle the new engine refuses to read.
  • buildEngineAssets is an optional build-hook call that puts the engine's shaders in the app's own generated tree instead of flutter_scene's.
  • Breaking change, legacyOnly and dataAssetsIfAvailable are removed in favor of generatedTree, now the default in SceneAssetMode, TextureAssetMode, MaterialAssetMode, and TargetShaderBundleAssetMode. A hook still passing a removed mode fails the build naming its replacement, since outputs moved out of build/ into the generated tree and an app loading by explicit asset key reads its new keys from the tree's manifest.json. Re-run dart run flutter_scene:init to migrate a hook and add the pubspec entry. The Dart data assets modes remain as explicit opt-ins and prune the tree entries they replace.
  • A build with no generated assets now fails with the exact pubspec lines to add instead of producing an app that dies at its first load.
  • Fixed a .fmat reference written against the package root binding to a path beside its scene document, which left the material unresolved at load and the geometry on an opaque fallback. A reference only rebases onto the document when a file is actually there, matching how the source-root loader reads the same scene.
  • resolveShaderBundleKey resolves a shader bundle built by buildTargetShaderBundleJson (or flutter_gpu_shaders) by name, for loadShaderLibraryAsync.
  • Build stamps fingerprint a source over a megabyte by size and modification time instead of reading it, cutting about 5 seconds per gigabyte off every build. Set flutter_scene_strict_hashing: true under hooks: user_defines: in the app pubspec to content-hash everything.
  • Switching asset modes needs a clean build. Nothing prunes assets from a previous mode out of an app bundle.
  • Breaking change, buildScenes and buildTextures no longer take outputDirectory. Outputs go to the app's generated tree, so a hook passing it fails to compile; drop the argument.
  • Breaking change, FmatMaterialBundleIndex.fromJson requires assetKey. The bundle and its sidecar resolve from the index's own key, so a direct caller passes the key it parsed.
  • Node.extractMeshData flattens a subtree's geometry into one MeshData with the descendant transforms baked in, and MeshData.toTriMeshShape/toConvexHullShape turn that into a collider, so an imported model no longer needs a hand-written walk to collide.
  • MeshData.transformed places a snapshot by a matrix, carrying normals by the inverse transpose and, through a mirror, flipping both tangent handedness and triangle winding.
  • The lit shaders declare one prefiltered-radiance sampler instead of one per layout, freeing two fragment texture units so a skinned shadow-casting draw fits GLES drivers reporting the 16-unit minimum.
  • Breaking change for raw ShaderMaterial shaders that sample the environment, they declare prefiltered_radiance as RadianceSampler and supply a radianceCubeFragmentShader variant built with FLUTTER_SCENE_RADIANCE_CUBE. .fmat materials are unaffected.
  • A material or sky that samples the environment without a cubemap-radiance variant now keeps its 2D sampler and is bound a placeholder instead of a mismatched cubemap, and says so in debug builds. PreprocessedMaterial takes radianceCubeFragmentShader for code that builds one directly rather than through a loader.
  • Breaking change, EnvironmentMap.prefilteredRadianceTexture and EnvironmentMap.prefilteredRadianceCube are gone. The single prefiltered-radiance sampler replaces the layout pair, so code reading either field reads the one texture the map now carries.
  • RenderItem.windingFlipped derives from its geometry instead of being assignable, so a mirrored transform reverses winding without callers tracking it.
  • Breaking change, the fscene component codec API is declarative. ComponentCodec.serialize is abstract, ComponentPropertyDef and ComponentPropertyKind moved to the scene schema model (constraints replace min/max/read), and flat codecs extend DeclarativeComponentCodec, deriving schema, realization, and delta serialization from one ComponentField list.
  • .fscene version 3. Component properties delta-serialize (values equal to their schema default are omitted) and audio attenuation settings nest; version 2 documents read unchanged.
  • package:flutter_scene/annotations.dart, @SceneComponent and typed property annotations that lower to schema constraints for generated codecs.
  • Unknown component types realize as lossless ForeignComponent placeholders and round-trip untouched.
  • Physics components register in any mount order. A rigid body, collider, joint, or character controller added before its world (or its sibling dependency) registers when the dependency arrives instead of staying inert.
  • registerPhysicsBackend is public, so physics backend packages can register simulation factories the way audio backends do.
  • FsceneComponentRegistry.unregister removes a registered codec; documents carrying the type realize it as a lossless unknown-type placeholder.
  • nodeRefOf and resourceRefOf recover document references from live nodes and realized resources, so custom codecs (generated ones included) round-trip them.
  • Debug builds launched with FLUTTER_SCENE_SOURCE_ROOT read scene sources straight from the project, and ext.flutter_scene.reloadScene patches loaded scenes in place.
  • Component schemas carry declarative editor gizmos (ComponentSchema.gizmo, the GizmoSpec primitive model, the @SceneGizmo annotation), and the builtin lights, camera, colliders, audio, environment volumes, and particle emitters declare them.
  • Builtin component schemas declare richer editing constraints, the camera projection is a fixed-option enum, its field of view carries hard degree bounds, and shadow, area-light, and volume fields gained slider soft ranges.
  • Scene.captureRenderGraph records one frame's render graph (passes, CPU timings, data flow, snapshot copies of written targets) behind the Scene.debugAllowRenderGraphCapture opt-in, and RenderPassContext.debugBlackboardTexture exposes raw pipeline textures to debug overlays.
  • Screen-space contact shadows for the sun via DirectionalLight.contactShadows, grounding small contacts that shadow-map resolution and bias miss.
  • Screen-space indirect light via AmbientOcclusionSettings.indirectLight, crediting one bounce of scene radiance to newly visible sectors of the occlusion bitmask.
  • Rect area lights via RectAreaLight and RectAreaLightComponent, shaded with linearly transformed cosines so panel highlights stretch and fall off physically.
  • Film-look color grading via ColorGradingSettings.lut, loading Adobe .cube tables with ColorLut.fromCubeAsset and blending with lutBlend.
  • Environments persist the grading LUT (.cube reference and blend) in .fscene documents, and ColorLut.sourceAsset reports where a table was loaded from.
  • Percentage-closer soft shadows via DirectionalShadowFilter.pcss, sharpening shadows at contact and widening them with caster distance scaled by DirectionalLight.angularRadius.
  • Depth of field focuses on translucent depth-writing surfaces (fmat depth_write: true, transmissive PhysicallyBasedMaterial) instead of the backdrop seen through them.
  • Ground-truth ambient occlusion via AmbientOcclusionSettings.method, integrating horizon-slice visibility with sliceCount/stepsPerSlice controls and an optional constant-thickness visibilityBitmask mode.
  • AmbientOcclusionSettings.multiBounce keeps albedo-tinted bounce light in occluded creases instead of darkening them to gray.
  • AmbientOcclusionSettings.bentNormals steers indirect diffuse along the average unoccluded direction and enables SpecularAmbientOcclusionMode.bentCone.
  • Environment resources persist every ambient-occlusion control, including the new method, slice, thickness, bent-normal, and multi-bounce fields.
  • AmbientOcclusionSettings.intensity defaults to 1.0 and both methods are calibrated there; the obscurance estimator folds its former 2x, so halve any explicitly set obscurance intensity to keep its look.
  • Retuned enable-time defaults, bloom intensity 0.15, chromatic aberration 0.2, and auto-exposure clamps of -4 to +4 EV.
  • Breaking change, .fscene version 2 uses one native coordinate system and offline glTF import bakes source coordinates into it.
  • Removed Handedness, UpAxis, StageMetadata.unitsPerMeter, NodeSpec.excludeFromWindingParity, SkyEnvironmentSpec.castShadows, and the directional-light component schema's direction property.
  • Runtime glTF import keeps source buffers unchanged and resolves coordinate winding in the renderer.
  • Directional-light nodes aim along native local +Z and support explicit primary-light priority.
  • Fscene directional lights preserve the complete cascaded-shadow configuration.
  • Text scenes can reference a binary payload sidecar with payloadSource.
  • Fixed world-transform assignment under transformed parents corrupting the parent's cached transform.
  • Fixed in-memory glTF import dropping punctual lights and material variants.
  • GPU memory can be inspected and released. takeMemoryReport() reports what the engine's shared caches are pinning, releaseTexture/releaseScene give a claim back, and clearTextureCache/clearSceneTemplateCache drop everything.
  • ResourceGroup.track scopes a load to the group's lifetime, so dispose() releases the claims it took. Previously dispose() only released the progress notifier despite the name.
  • Fixed ResourceGroup throwing when it was disposed while a tracked load was still in flight, which is what tearing down a level mid-load does.
  • Fixed loadScene keeping a scene template claim when it threw after the template loaded, so a caller that got no Node no longer has to issue a compensating releaseScene.
  • PhysicallyBasedMaterial and glTF import support every ratified KHR_materials_* extension with scene-native property names.
  • Scene startup loads the shared physical-material shader bundle so every PhysicallyBasedMaterial property remains synchronous.
  • Shader build hooks keep only the target platform backends in generated bundles.
  • KHR_texture_transform applies independently to every built-in and advanced material texture.
  • Geometry and material textures support both UV0 and UV1, including textureInfo.texCoord in both glTF import paths.
  • ShaderMaterial owns the vertex stage too. Pass a vertexShader (per MeshVariant, so skinned and shadow passes can differ) and set uniforms and textures on either stage with ShaderStage, so a hand-written shader pair needs no subclassing.
  • Geometry can declare its own pipeline vertex layout with setVertexLayout, and VertexAttributeDescriptor/VertexBufferDescriptor/VertexLayoutDescriptor are public.
  • Custom vertex attributes work on skinned meshes.
  • A ShaderMaterial that supplies a vertex shader for some mesh kinds but not others warns in debug builds, naming the missing variant, instead of failing opaquely at pipeline creation.
  • Debug builds check a custom material's uniform blocks against the shader's reflection, so a misspelled or optimized-out block name and a buffer too small for its std140 layout raise named exceptions instead of failing at bind time or reading past the end.
  • Debug builds check a caller-declared vertex layout against the buffers actually bound, so a slot count mismatch raises instead of feeding the pipeline undefined vertex data.
  • IndexType, VertexFormat, and VertexStepMode are exported, so 32-bit indices and caller-declared layouts no longer need lib/src imports.
  • Made first-party shader/material hooks and examples DataAssets-only, with migration guidance for legacy assets.
  • buildMaterials registers generated outputs as DataAssets when available by default.
  • Added Node.castsShadows for excluding individual meshes from shadow passes.
  • Added GeometryBufferArena and GeometryBuilder.build({bufferArena, retainCpuData}) for lower-overhead immutable mesh batches.
  • Added per-instance colors through InstancedMesh.addInstance(color:) and setInstanceColor.
  • Breaking change, instanced vertex layouts now require instance_color and use an 80-byte instance stride instead of 64 bytes.
  • Added InstancedMesh.updateInstanceTransforms for allocation-light bulk motion and InstancedMesh.cullInstances for opt-in per-instance culling.
  • Added InstancedMesh.sortTransparentInstances to skip unnecessary particle sorting.
  • Added RenderView.cullingPlanes for application-defined frustum planes and Scene.warmUp(includeOffscreen:) for full-scene preparation.
  • Added SunLight.cacheStaticShadows and DirectionalLight.cacheStaticShadows for continuously changing shadow lights.
  • Added SunLight.shadowFilter and DirectionalShadowFilter.fixedPcf for stable lower-ALU shadow filtering.
  • Tightened stable cascade fitting to increase effective shadow resolution.
  • Reduced shadow-map color bandwidth with single-channel fp32 tiles.
  • Fixed cascade-edge striping from normal-biased receiver positions.
  • Switched material and resolve color conversion to exact sRGB transfer functions.
  • Cached instanced bounds and render data to keep moving-camera culling allocation-light.
  • Skipped per-instance bounds packing when instance culling is disabled.
  • Skipped per-instance culling when an entire batch is inside every active plane.
  • Reused large transient buffers across changing instance counts.
  • Translucent instanced meshes now sort as one batch, with instances ordered within it.
  • Translucent draws sort back to front by view-axis depth through their geometry bounds center.
  • Double-sided lit materials reverse geometric normals on back-facing fragments.
  • Fixed instanced meshes losing their lighting, shadow, and fog bindings on GLES, which drew them (and any mesh sharing their pipeline) black.
  • Fixed anisotropy strength being ignored by environment lighting and using an isotropic visibility term for analytic lights.
  • Fixed anisotropic materials exposing primitive triangles by importing and interpolating authored tangents.
  • Vertex payload layouts include UV1 and tangents under versioned names, growing unskinned payloads by 50% and skinned payloads by 30%; older .fscene layouts upgrade when loaded.
  • Fixed runtime glTF normal maps building color-filtered mips, which skewed minified normals and washed out reflective materials.
  • Fixed uncompressed .fsceneb textures uploading without mipmaps, so a cooked scene is mipmapped whether or not compressTextures is set.
  • Fixed cooked .fsceneb and .fstex textures sampling without anisotropic filtering, which blurred them at grazing angles.
  • Texture resources record what their pixels represent, so mip levels downsample by role (normal maps average as vectors, color in linear light).
  • buildScenes warns when a texture is not block aligned and falls back to uncompressed, instead of dropping the compressed form silently.
  • buildScenes and buildTextures take alignForCompression to resample a misaligned source up to the next multiple of 4 rather than failing or storing it uncompressed.
  • Cooked textures build their mip chain on a background isolate, so a large uncompressed scene no longer pays for it on the calling thread.
  • Devices measured to sample every texture at its base mip skip mip chains entirely, reclaiming the memory and transcode time they were spending on levels the sampler ignores, and say so once at startup.
  • Loose images cook to compressed, mipmapped .fstex through buildTextures, loaded by source path with loadTexture (shipped in 0.20.0, missing from its notes).
  • Fixed a RangeError when an updatable mesh rebuilds at a smaller vertex count.
  • Fixed ambient-occlusion banding and over-darkening with normalized sampling, robust normals, and depth-aware filtering.
  • Ambient occlusion gains power, detail, horizon, direct-light, depth-mip, and specular controls. Intensity now scales obscurance, defaults to 2.0, and its former contrast role is power.
  • Baked and screen-space ambient occlusion now combine with min instead of multiplication.
  • Added ToneMappingMode.agx with configurable Scene.agxWhite and Scene.agxContrast, persisted by environment resources.
  • Added Material.depthBias, a world-space camera offset for coplanar surface details.
  • Breaking change, custom Geometry.bind overrides must add the named parameter double depthBias = 0.0.
  • EnvironmentSettings preserves every ambient-occlusion control and can apply only its environment look with applyLookTo.
  • Added EnvironmentMap.constantDiffuse and declarative ConstantEnvironment ambient lighting.
  • Added declarative torus and icosphere geometry specs.
  • ParticleSystem.prewarm is now readable after construction.
  • Nested prefab material overrides and linked material/scene references now compose and round-trip.
  • Custom asset bundles can load fmat shaders from bytes and provide their own fmat material loader.
  • Cooked glTF scenes import photometric punctual lights for use with physical camera exposure.