Sufficit.Graphics.Babylon 1.0.35

Suggested Alternatives

Sufficit.Graphics.WebGpu

Additional Details

The Babylon.js backend was removed on 2026-11-29. Use Sufficit.Graphics.WebGpu: <WebGpuView> renders the same Sufficit.Graphics scene and explains when the browser has no WebGPU.

dotnet add package Sufficit.Graphics.Babylon --version 1.0.35
                    
NuGet\Install-Package Sufficit.Graphics.Babylon -Version 1.0.35
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Sufficit.Graphics.Babylon" Version="1.0.35" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sufficit.Graphics.Babylon" Version="1.0.35" />
                    
Directory.Packages.props
<PackageReference Include="Sufficit.Graphics.Babylon" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Sufficit.Graphics.Babylon --version 1.0.35
                    
#r "nuget: Sufficit.Graphics.Babylon, 1.0.35"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Sufficit.Graphics.Babylon@1.0.35
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Sufficit.Graphics.Babylon&version=1.0.35
                    
Install as a Cake Addin
#tool nuget:?package=Sufficit.Graphics.Babylon&version=1.0.35
                    
Install as a Cake Tool

Sufficit.Graphics

A 3D visualisation component for Blazor, written in C#: product viewers, configurators, digital twins and 3D dashboards without leaving .NET. You build, load, animate and edit scenes in C#; the library draws them with physically based rendering on WebGPU. The scene model does not depend on the GPU, so it also runs in tests and on servers.

It is a component, not a game engine: no editor, no scripting runtime, no asset pipeline of its own. glTF is the asset format.

  • Scene model in pure C#. Nodes, meshes, PBR materials (metallic-roughness), textures, cameras, punctual lights, skins, morph targets, keyframe animation with cross-fade, and procedural meshes. No GPU dependency; trimmable and AOT-compatible.
  • Formats. glTF 2.0 and GLB, both read and write. OBJ and MTL, read only.
  • Character physics. de Leva segment masses, centre of mass, damped pendulums for limbs, and an inverted-pendulum balance controller. Balance profiles (normal, drunk, focused, fatigued, or blends) can be switched by game events.
  • Native WebGPU renderer for Blazor. C# owns the WGSL shaders (metallic-roughness PBR), the camera, skinning matrices, transparency sorting and the per-frame draw list. A thin JavaScript layer only forwards resources and one binary packet per frame to navigator.gpu. On WebAssembly the packet is read in place, with no copy and no asynchronous round trip.
  • Live scenes. Add, remove or replace nodes, meshes, materials and lights after loading, or edit a material in place: the next frame shows it and only what is new is uploaded.
  • Picking. Scene.Raycast in the core, and an OnPick event on <WebGpuView> with the node, the primitive and the point under the pointer.
  • Babylon.js backend for Blazor (frozen). A fallback for browsers without a WebGPU adapter. It receives no new features and will be removed.

Live viewer · Plan · Market evaluation and scope · Similar projects and opportunities · Renderer comparison

Packages

Package Contents
Sufficit.Graphics Scene graph, assets, animation, MeshBuilder
Sufficit.Graphics.Formats.Gltf GltfReader (glTF and GLB) and GltfWriter (GLB)
Sufficit.Graphics.Formats.Obj ObjReader (OBJ and MTL)
Sufficit.Graphics.Physics BalanceController, DampedPendulum, SegmentMassTable, SupportPolygon
Sufficit.Graphics.WebGpu <WebGpuView> component and WebGpuRenderer (own renderer, WebGPU)
Sufficit.Graphics.Babylon <BabylonView> component and BabylonRenderer (Babylon.js backend)
Sufficit.Graphics.Cli sufficit-graphics inspect and convert (.NET tool)

glTF coverage

The reader supports:

  • Embedded, external and GLB buffers.
  • Sparse accessors and normalised or quantised attributes (KHR_mesh_quantization).
  • All primitive modes.
  • Skins, morph targets, and animations with LINEAR, STEP and CUBICSPLINE interpolation, including weights.
  • Cameras.
  • Extensions: KHR_lights_punctual, KHR_texture_transform, KHR_materials_unlit, KHR_materials_emissive_strength, EXT_texture_webp, and KHR_texture_basisu (passed through to the backend).
  • EXT_meshopt_compression, decoded in C#: attribute, triangle and index streams with the octahedral, quaternion and exponential filters (the output of gltfpack -c and -cc).

Files that require an extension the reader does not support, such as Draco, fail with a clear message.

Validated against 24 Khronos glTF sample assets and 150 production assets. The production assets are Quaternius characters with 65 joints and 43 clips, Stylized Nature MegaKit glTF and OBJ files, and Ultima's GLBs. Every asset also passes a GLB round trip.

Usage

using Sufficit.Graphics;
using Sufficit.Graphics.Animation;
using Sufficit.Graphics.Formats.Gltf;

var scene = GltfReader.Load("character.glb");
var player = new AnimationPlayer();
player.Play(scene.FindAnimation("Walk_Loop")!);
player.Update(1 / 60f);          // writes the pose into the nodes
GltfWriter.Save(scene, "copy.glb");

Blazor with the native WebGPU renderer (no third-party engine):

<WebGpuView Scene="scene" OnFrame="dt => { player.Update((float)dt); return ValueTask.CompletedTask; }" />

Click to pick, and change the scene while it is displayed:

<WebGpuView Scene="scene" OnPick="Picked" />

@code {
    void Picked(PointerPick pick)
    {
        if (pick.Hit is not { } hit) return;                       // the click missed every mesh
        hit.Primitive.Material!.EmissiveFactor = new(1, .6f, .1f); // edited in place, uploaded on the next frame
        scene.Add(new Node("marker") { Translation = hit.Point, Mesh = markerMesh });
    }
}

Blazor with the Babylon.js backend (Babylon.js must be on the page, for example <script src="https://cdn.babylonjs.com/v9.38.0/babylon.js"></script>):

<BabylonView Scene="scene" OnFrame="dt => { player.Update((float)dt); return ValueTask.CompletedTask; }" />

Balance with event-driven profiles:

using Sufficit.Graphics.Physics;

var balance = new BalanceController(gravity: Gravity.Default) { Profile = BalanceProfile.Normal };
balance.Profile = BalanceProfile.Lerp(BalanceProfile.Normal, BalanceProfile.Drunk, intoxication);
balance.Impulse(new(110, 0), bodyMass: 75, centerHeight: .98);   // N·s
var state = balance.Advance(new BalanceInput(com, leftFoot, rightFoot, soleHalfExtents, speed, dt));

Command line:

dotnet run --project tools/Sufficit.Graphics.Cli -- inspect path/to/assets
dotnet run --project tools/Sufficit.Graphics.Cli -- convert model.obj model.glb

Renderers

The viewer uses the native WebGPU renderer and falls back to Babylon.js when the browser has no WebGPU adapter; ?renderer=babylon forces the compatibility backend. On the Khronos samples the two renderers differ by 1 to 3 levels out of 255 on average per channel without tone mapping.

Fidelity is measured, not claimed. Over the 85 scenarios of the Khronos glTF Render Fidelity suite, scored against the Blender Cycles path-traced goldens (RMS colour distance in dB, lower is closer), the renderer averages -16.85. That is close to, and still behind, Babylon.js (-17.50), model-viewer on three.js (-17.55), the glTF Sample Viewer (-17.60) and Filament (-18.24). The largest gaps are missing features (a second UV set, sheen textures). Per-scenario numbers are in FIDELITY-RESULTS.md; the method is in the renderer comparison.

Viewer query options: demo=live (a scene edited four times a second; click a shape to pick it), demo=forest&count=N (instancing and culling stress test), demo=lake (water, calm=1 for a mirror), demo=night (fog, spot and point lights), wind=, winddir=, rain=, fog=, envint=, elev=, azim=, renderer=babylon, preset=fidelity, env=<url.hdr> or env=none, skybox=1, tonemap=none|agx|aces, exposure=, envrot= (degrees), bg=r,g,b (background, 0..1), embed=1 (canvas only), still=1 (rest pose), and radius= with fov= for a fixed (0, 0, radius) camera.

WebGpu (own) Babylon
Shaders and lighting WGSL in C#, glTF reference BRDF Babylon.js PBRMaterial
Skinning Joint matrices computed in C#, applied on the GPU Babylon bones linked to C# nodes
Browsers WebGPU (Chrome, Edge, Safari 26, Firefox 141+) WebGL2 and WebGPU
Image-based lighting Split-sum IBL with GGX prefilter on the GPU, SH9 diffuse, multiple-scattering compensation; .hdr environments or the built-in neutral studio; optional skybox Babylon environment (not wired by default)
Output Linear HDR target (MSAA), specular anti-aliasing, alpha-to-coverage, SSAO, bloom, output pass with PBR Neutral, AgX or ACES and the exact sRGB curve Babylon image processing
Lights Up to 8 glTF punctual lights (candela/lux per spec), shadow map from the first directional light Babylon lights (point/spot intensity treated as luminous power)
Morph targets Yes (GPU, weights per frame from C#) Not yet
Nature Wind (GPU vegetation sway shared with physics drag), rain streaks, wet surfaces, water with Gerstner waves, planar mirror, refraction and foam No
Light effects Cascaded sun shadows (up to 4, texel-snapped), spot-light shadows, alpha-tested shadow casters, volumetric fog with light cones and point-light halos Babylon volumetric light (separate)
Throughput Frustum culling in C# (camera, light and mirror), automatic instancing, delta packets (only changed objects are sent), synchronous zero-copy frames on WebAssembly, a frame builder that allocates nothing on steady frames, live scene updates, WASM AOT viewer, per-frame C#/JS timings Babylon scene graph
Materials Metallic-roughness plus KHR_materials_ior, specular, clearcoat, sheen, transmission, volume (factors), unlit, emissive_strength Babylon PBR
Missing Textures of the KHR material extensions, KTX2, point-light shadows, second UV set, render bundles, GPU culling Morph targets

Conventions

  • Right-handed, +Y up, metres, glTF units (lux and candela for lights).
  • System.Numerics row-vector matrices. glTF column-major arrays map element by element.
  • Default gravity is 9.8 m/s².
  • Each class or record lives in its own file, and no file exceeds 400 lines. The test suite enforces both rules.

Development

dotnet test Sufficit.Graphics.slnx
dotnet run --project samples/Sufficit.Graphics.Viewer

FBX and USD are converted to glTF offline. See the plan.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.35 118 11/29/2026 1.0.35 is deprecated because it is no longer maintained.
1.0.34 103 11/29/2026 1.0.34 is deprecated because it is no longer maintained.
1.0.33 110 11/29/2026 1.0.33 is deprecated because it is no longer maintained.
1.0.32 105 11/29/2026 1.0.32 is deprecated because it is no longer maintained.
1.0.31 101 11/29/2026 1.0.31 is deprecated because it is no longer maintained.
1.0.30 110 11/29/2026 1.0.30 is deprecated because it is no longer maintained.
1.0.29 110 11/29/2026 1.0.29 is deprecated because it is no longer maintained.
1.0.28 99 11/29/2026 1.0.28 is deprecated because it is no longer maintained.
1.0.27 104 11/29/2026 1.0.27 is deprecated because it is no longer maintained.
1.0.26 103 11/29/2026 1.0.26 is deprecated because it is no longer maintained.
1.0.25 115 11/29/2026 1.0.25 is deprecated because it is no longer maintained.
1.0.24 105 11/29/2026 1.0.24 is deprecated because it is no longer maintained.
1.0.23 106 11/29/2026 1.0.23 is deprecated because it is no longer maintained.
1.0.22 106 11/29/2026 1.0.22 is deprecated because it is no longer maintained.
1.0.21 106 11/29/2026 1.0.21 is deprecated because it is no longer maintained.
1.0.20 107 11/29/2026 1.0.20 is deprecated because it is no longer maintained.
1.0.19 105 11/29/2026 1.0.19 is deprecated because it is no longer maintained.
1.0.18 109 11/29/2026 1.0.18 is deprecated because it is no longer maintained.
1.0.17 108 11/29/2026 1.0.17 is deprecated because it is no longer maintained.
1.0.15 108 11/28/2026 1.0.15 is deprecated because it is no longer maintained.
Loading failed