If you are a regular reader of mine you might already be aware that I am a Dungeons & Dragons fan, as well as a fan of crypto, programming, 3D printing, and VR stuff.
Yeah, you guessed it, all these things are colliding in my brain!
What if ...
As I learn 3D CAD for my 3d printing, I keep arriving at all these automation ideas.
Blender itself as a CAD package is already highly scriptable ...
There are also things like OpenSCAD. Check my past articles about these :)
Blender Python API features:
Edit any data the user interface can (Scenes, Meshes, Particles etc.).
Modify user preferences, keymaps and themes.
Run tools with own settings.
Create user interface elements such as menus, headers and panels.
Create new tools.
Create interactive tools.
Create new rendering engines that integrate with Blender.
Subscribe to changes to data and it’s properties.
Define new settings in existing Blender data.
Draw in the 3D Viewport using Python.
... the plugin community is one of the best parts about Blender, even when the core product doesn't have what you need, you can count on someone else making a solution for you.
BUT!
The models you produce with Blender, including surface textures and animations, can be exported in multiple formats, most of which will be super familiar to anyone who has done 3D printing or CNC ...
- OBJ
- FBX
- STL
- PLY
- COLLADA
- 3DS
3D Meets the Web
One of the best for interchange and interoperability is the gLTF standard.
GLTF (GL Transmission Format) was created by the Khronos Group, who also created Open/WebGL, Vulkan, etc and has the backing of AMD, Nvidia, Apple, Google, Nintendo, etc.
You can package it in several ways, including JSON, which is very handy for my purposes. We are talking about the web so load times and bloat come into play, but not to worry ...
Draco Compression
No, this is not a Harry Potter reference - You can shrink your files down using glTF-Draco
Compared to the regular .bin file size, you'll find Draco-Compression does an excellent job.
glTF-Embedded on the other hand is like the Binary format, being bundled into one file, but it is formatted in JavaScript and Python-friendly JSON that you can open in your editor.
Of course, you could load a file into memory and then convert it too.
ThreeJS
With our file generated as GLTF we can display it online using ThreeJS just as if it was home-grown geometry like so:
// Scene
const scene = new THREE.Scene()
// Draco compression if used
const dracoLoader = new DRACOLoader()
dracoLoader.setDecoderPath('/draco/')
// Load using GLTF
const gltfLoader = new GLTFLoader()
gltfLoader.setDRACOLoader(dracoLoader)
gltfLoader.load(
'/models/BB/dragon-bugbear-joined.glb',
(gltf) =>
{
gltf.scene.scale.set(0.05, 0.05, 0.05)
scene.add(gltf.scene)
}
)
What does this have to do with NFTs?
Picture your regular NFT but it is a 3D model that you can zoom, pan, rotate, light up!
Now imagine it is generated with a combination of rare and popular assets ...