Non-destructive Painting in Dust3D

Implementing the next coming feature, Non-destructive Painting, is one of the most exciting moments of coding Dust3D. Dust3D is a 3D modeling software, featuring a semi-auto generation workflow of 3D assets making.

What’s Non-destructive Painting? The painting result, including the colors and the positions of the colors, are mesh independent, and are been stored in a voxel grid.

When new paint action committed, the mouse position will be converted to a voxel cell, color info will be updated to that cell, and based on the current brush size, neighboring voxel cells will be updated with a gradient color as well. The final mesh color calculation is similar with the painting process, the only difference is that, paining is updating to voxel cell, mesh coloring is fetching from voxel cell.

Imaging your house been split to 100x100x100 cells, every brush you draw in the space, will lit one or more cells. You are not painting in a 2D space, but in real 3D. There is a voxel editor called MagicaVoxel, is modeling in this way.

In Dust3D software, you are not allowed to edit vertex position directly, because all the vertices, quads, triangles are generated automatically, based on the nodes on the canvas you drawn. Any node or edge between nodes been changed, the mesh will be regenerated. The traditional vertex painting will not work on this workflow, unless you lock the generated mesh. Once you lock the mesh generation, you lose the chance to modify the mesh topology by nodes.

By introducing this 3D space painting, you are free to change the nodes even after the painting is finished.

Here is the demonstration of painting a banana mesh in Dust3D, and the next video shows how Non-destructive works.

This feature will be available in Dust3D 1.0 RC 7 soon.

Join mailing list and follow twitter to get updates.

New Features in Dust3D 1.0.0-rc.1

Dust3D is a 3D modeling software for indie developers to quick create video game characters. There are many new features been introduced in this release candidate version: Dust3D 1.0.0-rc.1

New Rig Generator

New rig system are more stable than the previous version, and is capable of handling uncombined meshes during the skinning and weighting processes. You can check the Cat example model from File / Open Example to see how to create a run motion which then could be exported as FBX and GLB for importing to Unreal Engine, Unity, Godot Engine or other game engine.

Remesh

The state of the art Instant Meshes is been introduced to remesh the model based on the poly count setting. It’s native built-in, not invoked by command line. Choose the target poly count from component context menu you can get your model or component remeshed instantly.

Cloth Simulation

An easy cloth simulating system based on Samer Itani’s FastMassSpring implementation.

Spanish and Italian

Thanks MrAlexEsisteGia for the Italian translation and azagaya for the Spanish translation. Two new languages are been added.

UI Improvements

Thanks to Karl Robillard’s contributions, the window size could be preserved between runs, and many useful shortcuts for menu items are been added.

Join mailing list and follow twitter to get updates.

Procedural 3D Model Generation in Dust3D

In this article, I will try to introduce you the Procedural Generation feature in Dust3D using JavaScript.

About Dust3D

Dust3D is a free and open-source software for quick making 3D model with texture and rig automatically generated. It supports Linux, MacOS, and Windows.

In case you never use this software before, Here is a short demo on how to make a model in this software in none procedural mode.

The progress of modeling is to put nodes on canvas. By modifying the radius and position of the nodes, and other settings, you control the shape of the generated model.

Procedural Generation using JavaScript

In recent beta release, there is a new feature which allows you to generate nodes from JavaScript. It’s similar as web browser parse JavaScript to create HTML document. For example, the following JavaScript code will generate a paragraph in web browser,

var paragraph = document.createElement("p");
var node = document.createTextNode("This is text node under paragraph element.");
paragraph.appendChild(node);
document.body.appendChild(paragraph);

In Dust3D, you can create a node in a similar way,

var component = document.createComponent();
var part = document.createPart(component);
var node = document.createNode(part);
document.setAttribute(node, "x", 0.5);
document.setAttribute(node, "y", 0.5);
document.setAttribute(node, "z", 1.0);
document.setAttribute(node, "radius", 0.2);

Copy and paste the code to the script editor of Dust3D to run it

This will generate a node on canvas, and then the node been further generated into a cube mesh.

There are two circles on the canvas, orange circle represent the front view, green circle represent the side view. And the small triangle is the model center anchor.

Dust3D Document Structure

From the code, you may noticed that there are component, part, node, and attributes. Let’s explain a little bit here, for details you may need to check the Dust3D Script Reference.

1. Document 2. Canvas 3. Nodes and Edges 4. Part 5. Component

A document shows as a window in Dust3D, you draw nodes and connect nodes with edges on the canvas, all the connected nodes and edges grouped as parts. One document can have multiple parts. Each part belongs to a component.

Now let’s make a more complex example to understand these concepts.

More Complex JavaScript Example

function createNode(part, origin, radius)
{
    var node = document.createNode(part);
    document.setAttribute(node, "x", origin.getComponent(0));
    document.setAttribute(node, "y", origin.getComponent(1));
    document.setAttribute(node, "z", origin.getComponent(2));
    document.setAttribute(node, "radius", radius);
    return node;
}

function createLine(fromPosition, fromRadius, toPosition, toRadius, segments)
{
    var component = document.createComponent();
    var part = document.createPart(component);
    var previousNode = undefined;
    for (var i = 0; i <= segments; ++i) {
        var alpha = (i + 0.0) / segments;
        var origin = fromPosition.clone().lerp(toPosition, alpha);
        var radius = fromRadius * (1.0 - alpha) + toRadius * alpha;
        var node = createNode(part, origin, radius);
        if (undefined != previousNode)
            document.connect(previousNode, node);
        previousNode = node;
    }
    return part;
}

var fromPosition = new THREE.Vector3(0.5, 0.8, 1.0);
var fromRadius = 0.3;

var toPosition = new THREE.Vector3(0.5, 0.2, 1.0);
var toRadius = 0.1;

var segments = document.createIntInput("Segments", 3, 2, 10);
console.log("Hey, we accept parameter from the UI input control! The segments is " + segments);

var linePart = createLine(fromPosition, fromRadius, toPosition, toRadius, segments);
document.setAttribute(linePart, "subdived", "true");

The above JavaScript code generates a cylinder, from the down right corner, you can see a Segments slider control, adjust the slider, the generated result will change according to the segments value you modified. You may need toggle the settings in view menu to see the wireframe, the actual generated segments may greater than the value you configured because of intermediate nodes generation.

Also, there is a text box above the slider, shows

Hey, we accept parameter from the UI input control! The segments is 3

This is the console output. Yes, you can use console.log just as you use it in web browser.

Where to Go From Here?

If you have successfully tried the example code, now it’s time to dive deeper by checking the Dust3D Script Reference, to see a full API and attributes list. You can also check the Procedural Tree example from the Open Example menu which requires 1.0.0-beta.22 and above versions.

Dust3D is very young, any contributions are welcome, if you have any suggestions or want contribute a new feature please don’t hesitate to raise a issue here or make a pull request.

Last, I use my Procedural Tree v3.0 to end this article, please enjoy your procedural generation and welcome to share your script and screenshot to our forum.

Dust3D awarded Epic MegaGrants

I am very excited to share that Dust3D has been awarded Epic MegaGrants.

Dust3D is a 3D modeling software for quick making game assets with texture and rig automatically generated, it supports Linux, MacOS, and Windows. And it’s fully opensourced since the first day, https://github.com/huxingyi/dust3d

Epic MegaGrants is a funding provided by Epic Games,

to support game developers, enterprise professionals, media and entertainment creators, students, educators, and tool developers doing amazing things with Unreal Engine or enhancing open-source capabilities for the 3D graphics community. https://www.unrealengine.com/en-US/megagrants

Thank you Epic Games and all the contributors,

Siaržuk Piatroŭski  
PowPingDone
anderejd  
Alistair Miles  
hdu  
Ian Diaz  
Skullfurious  
Gamefromscratch  
RSDuck  
xtvjxk123456  
Zireael07  
glasyalabolas  
David Patrick  
Abraão Filho  
probonopd  
John Tsiombikas  
Jared Deckard  
Brandon Vandegrift  
iKlsR  
Jimmy Gunawan  
mikeruddy  
Helspank  
Demorde  
vanous  
justStand  
Ruben Niculcea  
boynet  
fornclake  
bvanevery  
Toshio Araki  
Evan Gruda  
KeepFenDou  
Kubilay Yalçın  
Satish Goda  
Sawm Fawk  
Erlend Sogge Heggen  
Michael Nowak  

* Ordered by first contribution

there are many others who also give invaluable supports not listed, thank you all, the grant will enable more possibilities for this tiny software.

Please stay tuned by join our mailing list and twitter hash tag #10minuteseveryday!

Dust3D on Raspberry Pi 3 Model B+

My friend Kevin Liang, who helped me 3D printed many cool Dust3D models, bought a Raspberry Pi 3 Model B+, the first thing to do when he received this tiny size computer is to run Dust3D, the same tiny size 3D modeling software.

Unfortunately, the Travis CI generated AppImage file can not run on Pi’s ARM CPU. But we can always build from source.

Most of the needed dev tools are out of the box on the default system, such as gcc, make. The Dust3D build instructions which written for Ubuntu, works like a charm on Pi. However, it always failed on the same file nodemesh/combiner.cpp, this file used CGAL library heavily. Every time, the machine dies on compiling this file, all system lose response. After power off, try, die, power off again, try, die again, several times, we found, out of memory is the root cause.

Googling keywords, “gcc low memory”, the first answer by Colin lan King shows how to create large swap memory for linux. So we created 4G swap for Pi to replace the default 100M swap.

Finally, more than one hours building, we succeed running Dust3D on Raspberry Pi.

The following are the full commands to build Dust3D on a Raspberry Pi 3 Model B+ with default system.

; Prepare 4G virtual memory for building, the default 1G memory and 100M swap are not enough to build.
; (The following swap image creating script comes from Colin lan King)

$ dd if=/dev/zero of=swap.img bs=1M count=4096
$ mkswap swap.img
$ chmod 0600 swap.img
$ sudo chown root:root swap.img
$ swapon swap.img



; Install dependencies

$ sudo apt-get install qtbase5-dev
$ sudo apt-get install qttools5-dev-tools
$ sudo apt-get install libcgal-dev
$ sudo apt install cmake
$ wget https://github.com/CGAL/cgal/releases/download/releases/CGAL-4.13/CGAL-4.13.zip
$ unzip CGAL-4.13.zip
$ cd CGAL-4.13
$ mkdir build
$ cd build
$ cmake ../
$ make
$ sudo make install



; Build Dust3D

$ git clone https://github.com/huxingyi/dust3d.git
$ cd dust3d
$ qmake -qt=5 -makefile
$ make



; Run Dust3D

$ ./dust3d