flutter_scene 0.15.0
flutter_scene: ^0.15.0 copied to clipboard
A general-purpose realtime 3D rendering library for Flutter.
0.15.0 #
Custom materials and a post-processing effects chain.
- Added the
.fmatcustom-material format: declare typed parameters and a smallSurface()GLSL function instead of hand-binding a raw shader. ThebuildMaterialsbuild hook compiles a.fmatinto a shader bundle plus a metadata sidecar; at runtime,PreprocessedMaterialandMaterialParametersset the parameters by name with type checking and no manual std140 packing. The lower-levelShaderMaterialremains as an escape hatch. SeeMATERIALS.md. - Added a post-processing suite configured per scene via
Scene.postProcess: bloom, color grading (brightness, contrast, saturation, white balance, lift/gamma/gain), vignette, chromatic aberration, and film grain. Each effect is off by default. - Added
PostEffect, a custom post-processing effect authored as a fragment shader, the post-processing counterpart ofShaderMaterial. An effect runs before or after tone mapping and reads the current color throughinput_color. SeePOST_PROCESSING.md. - The tone-mapping pass is now the resolve pass: it applies exposure, color grading, the tone-mapping operator, and the display EOTF, and composites bloom.
- Fixed image-based lighting on the OpenGL ES backend.
- Building
.fmatcustom materials requiresflutter_gpu_shaders0.4.4 or newer.
0.14.2 #
Rendering fixes.
- Fixed mirrored geometry rendering inside-out. A node with a negative-determinant transform (a mirror or negative scale) reverses triangle winding, so its front faces were being culled. Cull winding now follows the sign of the node's world-transform determinant, matching the glTF 2.0 spec (section 3.7.4 Instantiation). Applies to the scene pass, the shadow pass, and instanced draws.
- Fixed
material.doubleSidedbeing ignored by the runtime glTF importer. Double-sided materials are no longer back-face culled.
0.14.1 #
Quality and packaging pass to a full pub.dev score.
- Now WASM-compatible: the build-hook helpers no longer pull
dart:ioonto the web/wasm dependency graph (they run on the native host only). - Added a package example and a fuller description.
- Bumped
flat_buffersto^25.9.23. - Internal: lint and formatting cleanup of the generated flatbuffer readers.
0.14.0 #
Renderer overhaul. The lighting/material/scene API changed in a few breaking ways (small consumer base, worth getting right). See below.
- Render graph. Rendering is now structured as an ordered list of
passes (
RenderGraph/RenderGraphPass/RenderGraphContext/Blackboard/TransientTexturePoolinlib/src/render/), with a transient-texture pool and a per-frame blackboard. The frame isShadowPass?→ScenePass→TonemapPass. - HDR pipeline. The scene renders into a floating-point
(
r16g16b16a16Float) color target, MSAA-resolved in linear; a full-screenTonemapPassthen applies exposure, the tone-mapping operator, and the display EOTF and writes the 8-bit swapchain. Material shaders output linear HDR premultiplied by alpha and no longer tone-map or gamma-encode (breaking for customShaderMaterialshaders; seeMATERIALS.md). - Tone mapping & exposure moved onto
Scene.Scene.exposure(default1.0) andScene.toneMapping(ToneMappingMode, default Khronos PBR Neutral; ACES / Reinhard / linear also selectable).Scene.physicalCameraExposure({aperture, shutterSpeed, iso})derives an exposure multiplier the photographic way. (ReplacesEnvironment'sexposure/toneMappingMode/exposureFromPhysicalCamera.) - Directional light + shadows.
DirectionalLight(direction, color, intensity, shadow knobs), assignable asScene.directionalLight, layered on top of the image-based lighting with a Cook-Torrance term. WhencastsShadowis set, a shadow-map pass renders depth from an orthographic light frustum; the PBR shader samples it with 3×3 PCF + normal-offset bias. - Image-based lighting rework. Diffuse irradiance is SH-9 (computed
from the radiance image), specular is a GPU-prefiltered "PMREM-style"
roughness-band atlas built once at
EnvironmentMapconstruction (prefilterEquirectRadiance, exported). The PBR shader picked up fp16-safe GGX, sqrt-free Smith visibility, a roughness floor, and Fdez-Agüera multiscatter energy compensation. The old brightness fudges (kEnvironmentMultiplier, the rough-surface blend) are gone. Environmentclass removed. Image-based lighting is nowScene.environment(anEnvironmentMap, defaulting to the new proceduralEnvironmentMap.studio()) plusScene.environmentIntensity(a scalar).PhysicallyBasedMaterial.environment(the per-material override) is now anEnvironmentMap?.EnvironmentMapchanges (breaking). Always carries a prefiltered atlas + SH-9 (no nullable getters). New:EnvironmentMap.studio()(the built-in procedural studio environment, used as the zero-config default).fromAssets/fromUIImagesdropped theirirradianceImageparams;fromGpuTexturesnow takes a prefiltered atlas (+ optional SH);empty()is a black atlas + zero SH. The bundledroyal_esplanade.pngis still available viafromAssetsbut is no longer the default; the unusedroyal_esplanade_irradiance.pngasset was removed.ShaderMaterial.useEnvironmentnow bindsprefiltered_radiance+brdf_lut(not the formerradiance_texture/irradiance_texture/brdf_lut).- Web support.
flutter_scenenow runs on Flutter web. Where Impeller and Flutter GPU aren't available, it renders through a built-in WebGL2 backend (a drop-in forflutter_gpu), and works under both the CanvasKit and Skwasm web renderers. On native platforms it still uses Flutter GPU at zero cost. - Single package (breaking for direct importer users).
flutter_scene_importerhas been folded intoflutter_sceneand is no longer published separately. Its build-hook helper now lives atpackage:flutter_scene/build_hooks.dart(buildModels). A curatedpackage:flutter_scene/gpu.dartexposes just the GPU types needed to author customShaderMaterialshaders (Shader,ShaderLibrary,loadShaderLibraryAsync,Texture, sampler types); the rest of the GPU layer is internal.
0.13.0 #
- Add
ShaderMaterial, the foundation for custom materials. Supply a fragment shader (compiled offline throughflutter_gpu_shaders/impellercinto a.shaderbundle), then bind uniform blocks and textures by name withsetUniformBlock/setUniformBlockFromFloats/setTexture. Render-state knobs (cullingMode,windingOrder,isOpaqueOverride) are exposed on the material. The opt-inuseEnvironmentflag binds the scene's IBL textures (radiance_texture,irradiance_texture,brdf_lut) when the fragment shader declares them. - Add
MATERIALS.md: an end-to-end guide to the engine uniform / varying contract for custom fragment shaders, std140 uniform-block packing, theflutter_gpu_shadersbuild-hook setup, and the limitations of the current surface (see issue #22 for the planned declarative material format). - The example app gains a worked toon-shader demo
(
examples/flutter_app/lib/example_toon.dart).
0.12.0 #
- Add bounding-volume and frustum-culling infrastructure. The scene
encoder now builds a
Frustumonce per render from the camera's view-projection matrix and skips entire subtrees whose combined local-space AABB lies outside it. - Skinned subtrees are culled against an offline-baked pose-union
AABB that covers every animated pose. The runtime falls through
to the always-visible path for skinned content imported via the
runtime GLB importer (
Node.fromGlbBytes/Node.fromGlbAsset) since the pose-union analysis runs only in the offline importer. - New public API:
Geometry.localBounds,Geometry.localBoundingSphere,Geometry.setLocalBounds(aabb, sphere).Mesh.localBounds(cached union of primitive bounds) andMesh.markLocalBoundsDirty().Node.combinedLocalBounds(cached union including transformed descendants),Node.frustumCulled(defaulttrue),Node.markBoundsDirty(),Node.isVisibleTo(camera, dimensions).Camera.getFrustum(dimensions).
0.0.1-dev.1 #
- Initial render box.
0.1.0 #
- Rewrite for Flutter GPU.
- Physically based rendering.
- More conventional interface for scene construction.
0.1.1 #
- Rename PhysicallyBasedMaterial and UnlitMaterial
- Fix environment lighting problems in PhysicallyBasedMaterial.
- Add default environment map.
0.2.0 #
- Skinned mesh import.
- Fix readme for pub.dev.
0.2.1-0 #
- Switch to pre-release versioning.
- Bump version of flutter_scene_importer.
0.2.1-1 #
- Bump flutter_scene_importer version.
0.3.0-0 #
- Add Animation/playback support (Animation, AnimationPlayer, and AnimationClip).
- Import animations from scene models.
- Add support for cloning nodes.
0.4.0-0 #
- Support node cloning for skins.
- Fix default/animation-less pose.
0.5.0-0 #
- Support non-embedded/URI-only image embeds.
0.6.0-0 #
- Fix memory leak in transients buffer.
- Optional MSAA support on iOS and Android (enabled by default).
- Cull backfaces by default.
- Fix animation blending bugs.
- Pin native_assets_cli to <0.9.0 (https://github.com/bdero/flutter_gpu_shaders/issues/3)
- Add car model and animation blending examples.
- Fancy readme and FAQ.
0.7.0-0 #
- Update to native_assets_cli 0.9.0.
- Update to flutter_gpu_shaders 0.2.0.
0.8.0-0 #
- Update to Flutter 3.29.0-1.0.pre.242.
0.9.0-0 #
- Update to native_assets_cli 0.13.0.
- Update to flutter_gpu_shaders 0.3.0.
0.9.1-0 #
- Fix invalid usage of textureLod on desktop platforms.
0.9.2-0 #
- Fix globalTransform calculation.
0.11.1 #
- Fix
Node.globalTransformsetter. The previous implementation computedtransform * parent.globalTransform.invert(), butMatrix4.invert()returns the determinant (adouble) and mutates the receiver, so this was scalar-multiplyingtransformby the parent's determinant rather than composing with the parent's inverse. Coincidentally produced correct results when the parent haddet=1, but produced garbage for any negative-determinant or non-uniformly- scaled parent.
0.11.0 #
- Add a runtime GLB importer.
Node.fromGlbBytes(Uint8List)andNode.fromGlbAsset(String)decode a glTF binary directly at runtime: no offline.modelconversion, no build-hook step. Useful for user-uploaded models, network-loaded assets, and model editors. (#12) - Bump
flutter_scene_importerto^0.11.0(pure-Dart.glb→.modelbuild hook; CMake is no longer required).
0.10.0 #
- Migrate from
native_assets_cli(discontinued) tohooks1.0. Breaking: build hook authors must nowimport 'package:hooks/hooks.dart'instead ofpackage:native_assets_cli/native_assets_cli.dart. (#82) - Drop the
--enable-experiment=native-assetsflag from the importer process invocation. The flag was rejected by Dart 3.10+ and was the literal cause of build failures for users on recent Dart channels. (#82) - Reorganize the repository as a pub workspace with separate
flutter_sceneandflutter_scene_importerpackages and anexamples/sibling. No user-facing surface changes from this; consumers see a cleaner package. (#36) - Update
flutter_gpu_shadersto^0.4.0(also migrated tohooks).