Behind-the-scenes of ChainZoku — Episode 3: 3D Challenges

Miinded
6 min readMay 9, 2024

--

Hello again,

EKCO here, co-founder of Miinded, and lead developer.

Welcome to another episode of the ChainZoku Deep Dive. This is Episode 3, following up on Episode 1 — How it started and Episode 2— Meet the Zokus. The topic of the day: how to lose all of your hair in the span of 2 months, also known as how to render a 2D image of a 3D Zoku in real time.

As a starter, if you haven’t already, you should take 5 minutes to read the extremely well-done Guide to ChainZoku, which will cover the basics of the project.

To make this article a bit more interesting, I’ve decided to interview myself using the questions we asked ourselves throughout the development process, and the answers we found.

Covering the basics

I’m probably not teaching you anything by saying that for an NFT to be considered as such (and visible on Marketplaces), it must be represented by a single image (PNG, JPG, WEBP, GIF). On top of that, it can also contain additional media in any format (video, HTML, image, text, etc.).

With Zokus being customizable and evolving NFTs, a major challenge for us has been to find a way to generate a 2D image of each Zoku image as quickly as possible, whenever the user decides to add or remove a piece of gear.

Moving from 2D to 3D

At Miinded, we’re no strangers to real-time 2D image generation. We’ve been experimenting with it for several years on our Cryptofoxes project.

But we like to push the cursors to the max.

How hard can it be? It’s still an image, isn’t it?

Nope! In the case of a 2D customization project, we use a stack of PNG images representing the various traits of the NFT. The images are added one on top of the other in a very precise order to create a complete image.

In 3D, this is not optimal! Because with the same process, there would be problems with shadows, highlights, superimposed elements and overall ugly rendering.

What’s 3D?

To make a 2D image, it’s “easy”: you open Paint, make 2–3 doodles, save as a PNG and you’ve got something, ugly of course, but you’ve got something.

In 3D, you don’t open Paint, you open Blender, Cinema 4D, 3DsMax, Maya and so on. These are all software programs with their own structures and varying degrees of functionality, and they’re very complex to get to grips with, even when it comes to making ugly things.

The ChainZoku team has an excellent — I’d even go as far as say one of the best 3D designers around. He works in multiple different softwares, such as Zbrush (sculpting), Substance Painter (texturing), Marvelous Designer (clothing simulation), and uses Blender to put everything together to create the final render.

Perfect, Blender has a Python API that allows all those developers who want to lose their hair to drive the software with code. LFG!!

So each Zoku has its own Blender file?

Not at all, each Zoku corresponds to a succession of Assets (cf: episode 2 — Meet The Zokus). So to create our Zoku, we need to create each Asset independently, in 3D.

It’s like 2D, but instead of having a stack of PNGs, we have a stack of 3D Assets. When you put it like that, it sounds so simple… But guess what? It absolutely isn’t.

What exactly is a 3D Object?

A 3D Object is 1 structure (Mesh), 3 images (1 texture, 1 normal map, 1 albedo), and the “stuff” that connects it all together.

The 3D Object is stored in a Blender file that can only be read by Blender software.

One 3D Object = 1 Blender file?

Each 3D Object must be placed in a 3-dimensional space represented by the X (horizontal), Y (vertical) and Z (depth) axes. Placement must be very precise, as the slightest deviation would be obvious. But we have a very large number of 3D objects to manage, all with very different placements. On top of that, we have to communicate with the 3D Artist to know every position of every 3D object… There’s too great a risk of error in the long run.

We’ve opted for a simpler approach: everything in the same Blender file! That way, the 3D Artist places the 3D Objects exactly where he wants, and we just have to read the positions. Simple enough, right?

Yet again, every simple solution has its limits: Blender file size.

ChainZoku at launch (it has kept growing ever since) has over 400 meshes and more than 1000 textures, representing 65GB of raw data. We have good PCs, but not yet at the level of NASA.

We had to divide the 3D Objects into different Blender files to reduce the weight of the Blender file while maintaining the correct positions of the 3D Objects.

By the time of launch, we had 7 Blender files of around 10 GB each, which is heavy but still manageable.

We created new ones post-launch in order to accommodate for new items being added.

From 3D to 2D

Now that we’ve got our 3D Objects well positioned in our Blender files, we can create the 2D image matching our magnificent Zoku.

To achieve this, we’ve created another blank Blender file containing only the pre-configured lights, imported the 3D Objects corresponding to the Zoku Assets one by one, and rendered the image via a Python script executed by Blender.

It’s as if a human launched Blender, imported the 3D Objects manually and clicked on “Render”, but here it’s done via code automatically.

We do this 2 times per Zoku, once for the main image, and a second time for the Portrait image.

The 2 images are then uploaded to our servers, compressed, cached in our CDN and finally made publicly available.

The whole process from rendering to upload takes about 1min, a respectable score.

Originally, we wanted to have rendering times of less than 10 seconds — which is technically possible to reach, but given the cost of render farms and servers, we decided not to.

Currently, rendering is done by a server specialized in 3D rendering. It has a GPU (NVIDIA RTX 3070) hosted in a datacenter in Paris. We developed a bespoke code and server interface in order to keep costs as low as possible. As of today, the server has already done 5,035 customizations — on top of having rendered every single original Zoku.

I’ll go into more detail on how our render farm works in a future article — it took us weeks or R&D!

You may think that all this sounds easy and logical, but to get to this point, there have been many meetings, tests and accelerated hair loss…

In the next article, I’ll tell you about OpenSea’s real-time 3D viewer, which was a big thorn in my side too

See you in the next one!

EKCO

-Every simple solution has its limits-

About Miinded

Miinded is a French-based multi-disciplinary web3 studio founded in 2021. We focus on creating unique experiences for creators and guide brands in their transition to web3. We offer a range of services to assist you develop, launch and scale your innovative projects, with our team providing expertise and guidance needed to make it a sucess.

We believe that blockchain lies at the core of this new era of data interaction and digital experience creation. Web3 represents the future of web development, going beyond apps to create a comprehensive ecosystem that supports our digital world.

Our services include custom smart contracts developed using the latest blockchain technologies, UX/UI design focused on intuitive user experiences, webdesign and development tailored to individual project needs, strategic consulting to ensure effective planning, and hosting services that meet specific requirements.

Our last collaborations include Pudgy Penguins, The Sandbox, Snoop Dogg, MekaVerse, and ChainZoku, which highlight the fusion of blockchain technology, digital tokens, and creative concepts to offer immersive digital experiences.

Get in touch to build with us: bonjour@miinded.com
X and Instagram accounts:
@MiindedStudio

--

--

Miinded

Team of 4. We develop smart contracts and websites for NFT artists.