Summary | Insert Model 3D adds a composer button that simplifies adding 3D models to a Discourse post. | |
Repository | https://github.com/Beholder-Vision/discourse-insert-model-3d | |
New to Discourse Themes? | Beginner’s guide to using Discourse Themes |
Install this theme component
Hi all,
This component lets your users add 3D models to their posts using the Google model viewer component. I created this component to let users of my Photogrammetry SaaS Beholder share models that they create on our shiny new Discourse forum and thought I’d also share it here in case it’s of use to other people. I couldn’t see another similar component, but then I only did a very quick search…
Instructions and screenshots showing how to use the component are below.
Any feedback or thoughts on this component are much appreciated. The model viewer component that I use to display the models has quite a lot of functionality so there’s likely quite a bit of scope to expand this component by exposing some of that functionality to users. I created this component by copy, pasting and modifying the insert video and mermaid components so I’d also really appreciate it if someone with more experience of writing Discourse component could cast their eye over the code and let me know what mistakes I’ve made.
Regards
Alan
Usage
When the component is installed users will be able to add 3D models to their
posts by clicking on the new cube icon in the composer.
Currently the 3D viewer will not download and display the 3D model straight away, instead it will display a poster (that can be customised) and will only load the model when the user clicks the ‘Load 3D Model’ button. The thinking behind this is to help users with limited bandwidth.
Admin Settings
In order for users to be able to upload models with this component you’ll need to add .gltf and .glb to the list of authorized extensions.
You’ll also likely need to up the limit for the max attachment size.
This is the probably the main limitation for using this component on hosted Discourse as there, on the lower subscription plans, the max size is limited to 30MB. To be fair though you probably don’t want your users to be uploading massive files and .glb and .gltf files can be greatly reduced in size if they’re generated by a program that supports Draco mesh compression.