Threed-Viewer

Filters ::: filter_threedviewer
Maintained by ETHzETH Zürich
3D viewer filter (.stl format)

Threed-Viewer 4.4

Moodle 4.4
Released: mandag den 27. januar 2025, 17:09

Threed-Viewer Moodle filter

This moodle filter uses a custom Javascript layer (threed-viewer) built on top of Three.js to display an interactive viewer for STL models and GLTF models and scenes.

The filter's work is limited to detecting the presence of links containing .stl, .gltf or .glb in the content and asking the Javascript library to be loaded.

Usage

There are two ways to add a viewer to content on moodle.

Basic customization

In the straightforward way, a link to an STL or GLTF file is added through the content editor. The appearance of the viewer can be controlled by passing query parameters:

<a href="http://mymoodle.com/draftfile.php/.../myfile.stl?width=300px&height=300px">myfile.stl</a>

There are 6 parameters that are recognized in this approach:

  • width (default: 100%) and height (default: 300 px) to control the size of the viewer
  • zoom (value > 0, default 1) to adjust the initial zoom
  • nowireframe to disable the display of the edges of the model (wireframe)
  • nocenter to use the reference frame of the original file
  • noscale to use the original scale (if used the zoom coefficient should probably be adapted)

Advanced customization

To use the full capabilities of threed-viewer, the users need to use its custom elements to wrap the link to the model file:

<threed-viewer width=50% height=400px controls help axi-helper toolbar>
    <threed-model scale center><a href="http://mymoodle.com/draftfile.php/.../myfile.stl">myfile.stl</a></threed-model>
</threed-viewer>

Some examples are provided here, and a live demo tool exists to check out the effects of the different parameters.

License

This filter is distributed under the GNU GPL 3.0+ License. It includes a bundled version of three.js (distributed under the MIT License) and libraries for decoding KTX2 textures and Draco compressed meshes (distributed under the Apache License 2.0).

Version information

Version build number
2024100100
Version release name
4.4
Maturity
Beta
MD5 Sum
a49fe8faff1867d2cf85d4cce458dba2
Supported software
Moodle 4.4
  • Latest release for Moodle 4.4

Version control information

Version control system (VCS)
GIT
VCS repository URL

Default installation instructions for plugins of the type Filters

  1. Make sure you have all the required versions.
  2. Download and unpack the filter plugin.
  3. Place the folder (eg "myfilter") in the "filter" subdirectory.
  4. Visit http://yoursite.com/admin to finish the installation