सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
model_viewer_plus एक Flutter विजेट है जो Android, iOS और Web प्लेटफॉर्म पर glTF और GLB फॉर्मेट में 3D मॉडल के रेंडरिंग और इंटरैक्शन की अनुमति देता है। यह Flutter एप्लिकेशन में डूबे हुए 3D कंटेंट को प्रदर्शित करने के लिए एक सुविधाजनक इंटरफेस प्रदान करता है, जिसमें घूमना, ज़ूम और पैन के जैसी सुविधाएं शामिल हैं। वेब के <model-viewer> तत्व पर आधारित, यह मूल Flutter को आधुनिक 3D रेंडरिंग क्षमताओं से जोड़ता है। उत्पाद प्रदर्शन, AR एकीकरण और इंटरैक्टिव विज़ुअलाइज़ेशन के लिए आदर्श है।
उपयोग
ई-कॉमर्स ऐप में उत्पाद विज़ुअलाइज़ेशन
इंटरैक्टिव शैक्षिक 3D सामग्री
एआर-समर्थित मोबाइल अनुभव
वेब-आधारित 3D मॉडल दर्शक
वर्चुअल टूर और वॉकथ्रू
मुख्य विशेषताएँ
glTF और GLB 3D प्रारूपों का समर्थन
क्रॉस-प्लेटफ़ॉर्म सुसंगतता (Android, iOS, Web)
एम्बेडेड टच और माउस इंटरैक्शन
कस्टमाइज़ेबल लाइटिंग और कैमरा नियंत्रण
pub.dev के माध्यम से हल्का एकीकरण
इनके लिए उपयुक्त
3D समृद्ध Flutter ऐप बनाने वाले विकासकर्ता
उत्पादों को प्रदर्शित करने वाले ई-कॉमर्स प्लेटफॉर्म
शैक्षिक और प्रशिक्षण अनुप्रयोग
Flutter का उपयोग करने वाले AR/VR सामग्री निर्माता
3D क्षमताओं का विस्तार करने वाले वेब विकासकर्मी
विचार योग्य बातें
glTF/GLB प्रारूप में 3D मॉडल की आवश्यकता होती है
गैर-मूलभाषा प्लेटफ़ॉर्म पर वेब-आधारित रेंडरिंग पर सीमित
कम-एंड डिवाइस पर प्रदर्शन में भिन्नता हो सकती है
मूल बातचीत के अलावा कोई निर्मित एनीमेशन समर्थन नहीं है
ब्राउज़र के WebGL समर्थन पर निर्भर
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
We use the Google APP, com.google.android.googlequicksearchbox to display interactive 3D models on Android.
The model displays in 'ar_preferred' mode by default, Scene Viewer launches in AR native mode as the entry mode.
If Google Play Services for AR (ARCore, com.google.ar.core) isn't present, Scene Viewer gracefully falls back to 3D mode as the entry mode.
Installation
pubspec.yaml
dependencies:model_viewer_plus:^1.10.0
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:
Alternatively, you can achieve this using a Network Security Configuration by defining a configuration file (e.g., res/xml/network_security_config.xml) and referencing it in the AndroidManifest.xml using the android:networkSecurityConfig attribute within the <application> tag.
Your network_security_config.xml should look something like this to allow traffic to localhost and 127.0.0.1:
This does not affect Android 8 and earlier. See #7 for more information.
app/build.gradle (Android only)
Change minSdkVersion to 24.
defaultConfig {
...
minSdkVersion 24
...
}
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:
Modify the <head> tag of your web/index.html to load the JavaScript, like so:
<head><!-- Other stuff --><scripttype="module"src="./assets/packages/model_viewer_plus/assets/model-viewer.min.js"defer></script></head>
./assets/packages/model_viewer_plus/assets/model-viewer.min.js will use the default js file which is included in this package's asset. The official site uses unpkg, by using https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js, you are using the latest version of <model-viewier>. You may replace the
value of src attribute with another CDN mirror's URL. But please notice that our model-viewer-plus maybe not able to keep up with the <model-viewier>'s latest version.
According to #44, the render quality maybe low on some mobile devices. Please consider adding <meta name="viewport" content="width=device-width, initial-scale=1" /> to the <head> of your web/index.html.
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.
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:
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.
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.
The platform browser might not support the features that Model Viewer
needs. See google/model-viewer#1109.