Obsidian Plugin

By Jesse Strijker | October 10th, 2024

Obsidian is “the private and flexible writing app that adapts to the way you think”. At least that is what they say on their website. But this application has made my notetaking to a whole new level, and made me into kind of a fanboy. 

It uses markdown files, so no fancy additions like word and google docs, and is itself very barebones, allow for incredibly fast loading times, and linking together of notes. This produces a very easily navigable note environment. kind of like your own Wikipedia. An additional feature is the graph you see below, that allows for easy navigation between notes aswell.

An incredible side of obsidian is the plugin culture. As opposed to platforms like notion who have everything already built in, making it slower and providing an overwhelming amount of options, obsidian allows you to pick and choose whatever functions you want to add to your notes. From amazing plugins like dataview, which allows you to query data from your notes using a form of sql. 

Obsidian has been making notetaking a pleasurable and clear activity for me, not distracting me with unnecessary elements. A plugin I also use is the ink plugin that allows for handwritten notes/elements within your notes aswell. These embeds are awesome and come in all sorts of different forms and sizes, from graphing to masonry style image galleries. 

Oddly enough, to my suprise, there was no such plugin yet for showcasing 3D models in your markdown note files. Even after searching the obsidian forums extensively to see if anyone was working on it, I came to the conclusion nobody had succeeded yet, most likely since it is a very very niche part of the internet. So I got to working.

Obsidian uses an api for its plugins, allowing you to modify certain portions of the application. This is not very open in a lot of options, mostly so for security and stability concerns, which makes a lot of sense, but also makes it hard to work with. The documentation is great however. But there is always a workaround, even though the electron application is not really meant for running code in it. There is the dataview plugin that very stably allows you to run a .js file in a markdown note. Which sprung the idea of attempting to use the three.js library in obsidian. For those unaware, three.js is a javascript library using webGL to render 3D objects in javascript, so it is commonly used in interactive or aesthetically pleasing websites. 

Now with a bunch of fidling, I got it working, being able to render a basic default cube in the obsidian note. Now this was done by just having the js in the note. The biggest struggle was loading the three.js library in some form, since import statements or downloading it would not work, but loading the script via CDN, seemed to do the trick. But this is not a plugin yet, nor very user friendly, so a lot of work was to be done. 

After a lot of work, setting up an actual plugin, I am now able to load locally hosted 3D files. I have thusfar only added support for stl and glb files, but am planning on adding a few more in the future. And allowing the users control, with simple orbitcontrols for the 3D scene, and more advanced controls via an easy text based interface, located in the note embed itself. Check the video below to see how the plugin functions

Showcase

Use and Adaptation

Now the only thing left to do, is create a post on the obsidian forum, and applying my plugin to the official plugin list, so people can actually download it. I will update this post if it gets admitted. 

Category: Programming, Data

Subject: Programming