All Projects → drydart → Model_viewer.dart

drydart / Model_viewer.dart

Licence: unlicense
A Flutter widget for rendering interactive 3D models in the glTF and GLB formats.

Programming Languages

javascript
184084 projects - #8 most used programming language
dart
5743 projects

Projects that are alternatives of or similar to Model viewer.dart

3dio Js
JavaScript toolkit for interior apps
Stars: ✭ 255 (+90.3%)
Mutual labels:  3d, vr, ar
Stereokit
An easy-to-use mixed reality library for building HoloLens and VR applications with C# and OpenXR!
Stars: ✭ 195 (+45.52%)
Mutual labels:  gltf, vr, ar
Egjs View3d
Fast & customizable 3D model viewer for everyone
Stars: ✭ 34 (-74.63%)
Mutual labels:  3d, gltf, ar
Vircadia
Vircadia open source metaverse platform, based on the former High Fidelity Virtual Reality Platform.
Stars: ✭ 110 (-17.91%)
Mutual labels:  3d, vr, ar
Building Server
A server to stream PostGIS 3D objects to the web
Stars: ✭ 11 (-91.79%)
Mutual labels:  3d, gltf
Cesium
An open-source JavaScript library for world-class 3D globes and maps 🌎
Stars: ✭ 8,095 (+5941.04%)
Mutual labels:  3d, gltf
Illixr
ILLIXR: Illinois Extended Reality Testbed
Stars: ✭ 33 (-75.37%)
Mutual labels:  vr, ar
Ueviewer
Viewer and exporter for Unreal Engine 1-4 assets (UE Viewer).
Stars: ✭ 1,083 (+708.21%)
Mutual labels:  3d, gltf
Cgltf
💠 Single-file glTF 2.0 loader and writer written in C99
Stars: ✭ 628 (+368.66%)
Mutual labels:  3d, gltf
Monodepth360
Master's project implementing depth estimation for spherical images using unsupervised learning with CNNs.
Stars: ✭ 41 (-69.4%)
Mutual labels:  3d, vr
Code Vr
🐍 Program and explore real applications with virtual reality! Learn how to program, compete to build apps, and even collaborate with other people in realtime, in game or not!
Stars: ✭ 131 (-2.24%)
Mutual labels:  gltf, vr
Xeogl
A WebGL-based 3D engine for technical visualization. Not actively maintained.
Stars: ✭ 920 (+586.57%)
Mutual labels:  3d, gltf
Openvr Northstar
This is a community driver to support the North Star headset on OpenVR.
Stars: ✭ 17 (-87.31%)
Mutual labels:  vr, ar
Assetkit
🎨 Modern 2D/3D - Importer • Exporter • Util - Library, also called (AssetIO)
Stars: ✭ 97 (-27.61%)
Mutual labels:  3d, gltf
Processing Android
Processing mode and core library to create Android apps with Processing
Stars: ✭ 643 (+379.85%)
Mutual labels:  vr, ar
Lullaby
A collection of C++ libraries designed to help teams develop virtual and augmented reality experiences
Stars: ✭ 1,062 (+692.54%)
Mutual labels:  vr, ar
Ar Pizza Slicer
5 different shapes!
Stars: ✭ 80 (-40.3%)
Mutual labels:  3d, ar
360vr
This is a small VR library that can quickly help you build VR app.
Stars: ✭ 99 (-26.12%)
Mutual labels:  vr, ar
Clay Viewer
3D model viewer with high quality rendering and glTF2.0/GLB export
Stars: ✭ 558 (+316.42%)
Mutual labels:  3d, gltf
React Force Graph
React component for 2D, 3D, VR and AR force directed graphs
Stars: ✭ 589 (+339.55%)
Mutual labels:  3d, vr

3D Model Viewer for Flutter

Project license Dart compatibility Pub package Dartdoc reference

This is a Flutter widget for rendering interactive 3D models in the glTF and GLB formats.

The widget embeds Google's <model-viewer> web component in a WebView.

Screenshot

Screenshot of astronaut model

Prerequisites

Compatibility

Android and iOS, with a recent system browser version.

Installation

pubspec.yaml

dependencies:
  model_viewer: ^0.8.1

AndroidManifest.xml (Android 9+ only)

To use this widget on Android 9+ devices, your app must be permitted to make an HTTP connection to http://localhost:XXXXX. Android 9 (API level 28) changed the default for android:usesCleartextTraffic from true to false, so you will need to configure your app's android/app/src/main/AndroidManifest.xml as follows:

--- a/example/android/app/src/main/AndroidManifest.xml
+++ b/example/android/app/src/main/AndroidManifest.xml
@@ -8,7 +8,8 @@
     <application
         android:name="io.flutter.app.FlutterApplication"
         android:label="model_viewer_example"
-        android:icon="@mipmap/ic_launcher">
+        android:icon="@mipmap/ic_launcher"
+        android:usesCleartextTraffic="true">
         <activity
             android:name=".MainActivity"
             android:launchMode="singleTop"

This does not affect Android 8 and earlier. See #7 for more information.

Info.plist (iOS only)

To use this widget on iOS, you need to opt-in to the embedded views preview by adding a boolean property to your app's ios/Runner/Info.plist file, with the key io.flutter.embedded_views_preview and the value YES:

<key>io.flutter.embedded_views_preview</key>
<true/>

Features

  • Renders glTF and GLB models. (Also, USDZ models on iOS 12+.)

  • Supports animated models, with a configurable auto-play setting.

  • Optionally supports launching the model into an AR viewer.

  • Optionally auto-rotates the model, with a configurable delay.

  • Supports a configurable background color for the widget.

Examples

Importing the library

import 'package:model_viewer/model_viewer.dart';

Creating a ModelViewer widget

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text("Model Viewer")),
        body: ModelViewer(
          src: 'https://modelviewer.dev/shared-assets/models/Astronaut.glb',
          alt: "A 3D model of an astronaut",
          ar: true,
          autoRotate: true,
          cameraControls: true,
        ),
      ),
    );
  }
}

Loading a bundled Flutter asset

class MyApp extends StatelessWidget {
// ...
          src: 'assets/MyModel.glb',
// ...
}

Loading a model from the file system

class MyApp extends StatelessWidget {
// ...
          src: 'file:///path/to/MyModel.glb',
// ...
}

Loading a model from the web

class MyApp extends StatelessWidget {
// ...
          src: 'https://modelviewer.dev/shared-assets/models/Astronaut.glb',
// ...
}

Note that due to browsers' CORS security restrictions, the model file must be served with a Access-Control-Allow-Origin: * HTTP header.

Frequently Asked Questions

Q: Why do I get the error net::ERR_CLEARTEXT_NOT_PERMITTED?

You didn't configure your AndroidManifest.xml as per the installation instructions earlier in this document. See also #7.

Q: Why does the example app just show a blank screen?

A: Most likely, the platform browser version on your device or emulator is too old and does not support the features that Model Viewer needs.

For example, the stock Chrome version on the Android 10 emulator is too old and will display a blank screen; it must be upgraded from the Play Store in order to use this package. (The stock Chrome version on the Android 11 emulator works fine, however.) See google/model-viewer#1109.

Q: Why doesn't my 3D model load and/or render?

A: There are several reasons why your model URL could fail to load and render:

  1. It might not be possible to load the model URL due to CORS security restrictions. The server hosting the model file must send appropriate CORS response headers for Model Viewer to be able to load the file. See google/model-viewer#1015.

  2. It might not be possible to parse the provided glTF or GLB file. Some tools can produce invalid files when exporting glTF. Always run your model files through the glTF Validator to check for this.

  3. The platform browser might not support the features that Model Viewer needs. See google/model-viewer#1109.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].