Jump to content

DEVBLOG: PRECISION IN BUILDING


NQ-Wanderer

Recommended Posts

In the upcoming 0.28 Panacea update, we will introduce the Vertex Precision Tool (VPT), which adds a whole new way of bringing detail to your creative designs.

 

This all may sound quite complex initially, but once you get used to the tool it’s quite intuitive. If you’ve been holding back because voxelmancy seemed too complicated, now’s the time to give it a try. By allowing you to simply equip the VPT and move the vertex around on a changeable grid, the process of designing with voxels is greatly simplified and far more user-friendly.

 

Here’s a brief demonstration of what the VPT looks like and how it’s used:

 

 

Heads up! The information in this blog leans heavily into the extremely technical side of things. Those who are into voxelmancy will probably dive in with unfettered joy. If building isn’t your jam, you may wish to stop here and get the TL;DR from one of your builder buddies later.

 

VOXELS DEFINED

 

Much of what you see in Dual Universe was built by players using voxels. The term “voxel” is very generic, a shortened form of “volume element”. Voxelmancy is an advanced form of building that can be quite complex, and there has always been a gap between building with standard geometric shapes and fine-tuned designs. The VPT aims to bring a game-changing  bridge for the gap between these building styles.

 

How exactly the voxels are implemented depends a lot on the software that’s being used. In DU, a voxel contains two things: material information and a vertex position information.

 

The material information is pretty straightforward; it is exactly the same as in a pixelated image where there is a material (think of it as a synonym of “color“) for each little square. We use what we call a uniform grid, meaning that voxels are put next to each other in a 3D grid and all have the same size. For example, on a planet voxels are 1 meter long (1m x 1m x 1m) whereas they can be 25 centimeters long (0.25m x 0.25m x 0.25m) on a user construct. It’s exactly how pixels work in 2D images, and you may already be familiar with these kinds of voxels because they are present in games like Minecraft.

 

VERTICES POSITIONS

 

Let’s drill down even deeper into the well of technical stuff.

 

As stated above, voxels contain material information and a vertex position information. The Vertex Precision Tool doesn’t touch materials, so let’s talk about vertices.

 

3D geometry is composed of vertices, and those vertices are linked together to form faces that will be rendered on your screen. For instance, take a simple single voxel cube. It is composed of one material, but has eight vertices on the eight corners. Since our voxels in DU store both a material and a vertex position, our “single voxel” here is composed of eight voxels because it takes eight vertices to form a cube!

 

This is where it starts getting complicated. We can consider that there are two voxel grids, one is the material grid and the other is the vertex position grid, and the two grids are shifted, dual to each other. There are eight vertices around a material, and there are eight materials (we can consider the void as a special kind of material) around a vertex.

 

So what are we talking about when we talk about a voxel? A little bit of both, depending on the context. Confusing right? We’ll try to be specific and talk about vertices, but remember there is only one vertex per voxel, although one voxel cube is composed of eight vertices (and thus is in reality eight voxels: one with matter and seven without matter.)

 

Take a look at this picture. It is in 2D because it’s easier to understand (and to draw), but this is the same thing in 3D. This image represents a voxel sphere (more like a circle since we are in 2D).

 

image5.png

 

The dotted lines are the uniform grid that represent the voxels. At the intersection of those dotted lines, you can have a blue dot, representing a material. So, we have our material grid: either emptiness or a blue material. Inside of all of those cells, there may be a vertex. There is a vertex if and only if all four corners are not the same. If one of the corners is blue and another one empty, it means we have some material change here and thus something to see. So we need a vertex to know where we see the surface. On each of those cells, we have a vertex represented. The vertices are then linked together to form the surface.

 

POSITIONS VALUES

 

Before the Panacea update, you could only get such a sphere with the sphere tool, but with the VTP you’ll now have the opportunity to change the vertex position manually. This raises the question: what coordinate system do we use?

 

In theory, we could use an infinite range of values. For example, we could say that the vertex should be at one third (on a given axis) in between the two materials as shown in the grid, so its value (on this axis) could be 0.333333333. It could also be 0.1415926535, or whatever we want.

 

However, we need to store those vertex positions, and we want to be efficient so that we don’t take too much disk usage so we encode the vertex position (on a given axis) on a single byte. This means we only have 256 different possibilities for a vertex position, but we don’t really need more. A vertex position is a coordinate with three numbers (for the three axes) where all of these numbers are integers (with a maximum 256 different possible integers).

 

So what are those possible values? Before answering that, we need to consider where a vertex can lie. On the sphere representation drawing, you can see that vertices are inside the zone defined by the four surrounding material points. This is indeed where a vertex should be most of the time, although we may sometimes want to overflow a bit, reach a little further than the vertex is supposed to. This will encroach on the zone of the neighbor voxel, but it does not have to be a problem. We decided that a vertex could lie on its one zone, but also the zone of its direct neighbors. On the 2D schematics above, it means that a vertex can be placed anywhere on the nine squares around it.

 

A vertex encoding actually encodes three vertice’s positions. We want to have an encoding for all the important positions, the middle of each of the three voxels and their borders. This means that we need a multiple of six. We’ll use 252 as it is very close to 256. Now let’s see this coordinate system in a picture. The picture below represents four simple cubes in voxels (yellow, red, blue and cyan).

 

We will be talking about the vertex shared by the red and blue cubes. There are actually two of those vertices in 2D, one top and one bottom; let’s talk about the top one. We state that the position it is in in the picture will be 0 (it’s a convention, the one chosen in the Vertex Precision Tool), and above the cubes we showed all the position values this vertex could have

 

image1.png

 

So 0 is the position of a vertex in a simple voxel cube. If we move the vertex into position 42 (both the top and bottom vertex of this red-blue junction), then the red rectangle will now be 1.5 times bigger, and the blue rectangle will be half its current size. If we move the vertices to -42, it would be the other way around. Note that all the values between -42 and 42 are the values where the vertex is supposed to be without overflow. This is the zone we described earlier.

 

If we were to move the vertices to value 84, then we would enter the territory of the vertex shared by the blue and cyan cubes. This becomes a little dangerous and could result in strange results. In this example, it would lead to the blue surface to completely disappear and be replaced by the red one. The blue voxel would still exist, it would just have a null volume.

 

And, in the example of these four cubes, if we were to go to a value above 84, it would result in an ill-formed shape because the blue shape would have a negative volume. This would probably create visual artifacts, and we may prevent this situation in the future.

 

ENCODING CHANGE

 

One last note for those who are familiar with voxelmancy. In Panacea, we use an encoding of 253 positions (from -126 to 126), which is different than it has been. We used an encoding of 255 positions (it was from -128 to 128 but previous -128 = actual -126). Since there is no exact mapping between the old encoding to the new one, this means that vertices in your constructs may be shifted up to 1mm (vertices at position 0 will not move, but those at extreme values will move the most). This will probably be unnoticeable, but we wanted to err on the side of caution and share this information.

 

You may wonder, why 253? It is for the reasons explained before, to have those nice -126, -84, -42, 0, 42, 84 and 126 values. The 255 system did not allow for that. We could have chosen 193, so that you could split a voxel in 2, 4, 8, 16, 32, and 64, but that would have meant a huge loss in precision and significantly deformed most constructs. So 253 it is, and you can now split a voxel in 42!

 

USING THE VPT

 

There are exactly 253 positions on a single axis including zero that a vertex can be in due to it being divisible over three voxels. Negative 126, 0, and positive 126. As such, the width of one voxel is exactly 84 positions. And each vertex can be moved exactly 1.5 voxel away from the center position.

 

Thus, the grid on which a vertex is moved is adjustable to a size that covers 1, 2, 4, 7, 14, 21 or 42 positions, 42 being the size of half a voxel. This allows the accurate placement to the finest detail or to quickly scale up and move a vertex by a half, a quarter, a sixth, or a twelfth of a voxel.

 

See the image below to get an idea of the different size grids available to the VPT.

 

image2.png

 

Once selected, the vertex cursor can then be moved with:

  • The up, down, left arrow and right Arrow keys for the x- and y-axis.

  • The Page Up and Page Down for the z-axis.

  • The Home key to send the cursor to the current position of the vertex.

  • The End key to send your cursor to the last confirmed coordinates.
    (This also happens by default when you change vertices.)

  • The Alt+Home key combination to send the cursor to the centered 0,0,0 coordinates.

  • Holding Control+Scroll will adjust the grid size between the available sizes.

  • Left-click confirms the placement and moves the selected vertex to the cursor.

 

The VPT will give you the finest precision possible, no more complex voxelmancy of copy-pasting things around to get a specific shape. You may not use this tool all the time, but when you do you’ll find it exceptionally helpful for fine-tuning.

 

WHEW, THAT’S A LOTTA INFO!

 

Still with us? We know there’s a lot of information to process, but we felt it was worthwhile to share the details with our voxelating community members that would appreciate seeing how the sausage is made (so to speak).

 

We can’t wait to see the cool new stuff Noveans build with the Vertex Precision Tool. As always, we encourage everyone to join the conversation on the forum in this thread. If you have questions about the VPT or want to share your thoughts and tips about voxelmancy in general, that’s the place to go.

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...