Advertisement

Fully destructible environment not limited to cubes

Started by January 13, 2016 11:47 PM
0 comments, last by swiftcoder 9 years, 1 month ago

Ok, so as I understand it, Voxel farm basically does what I'm talking about. And it's only like $300 a month for an Indie license.

But I'm trying to grasp the concept of what it does.

So you define "everything" in the world as equations. The simplest being that a flat cube is defined as existing inside the bounds of the cube and not existing anywhere else.

Then you subdivide the world into cubes around the client doing the rendering. These equations are "spatially partitioned" : you have the world divided into cubes or octrees, and in each cell of the cube or octree, you ask which equations apply in that space.

You then sample the points of the cubes (you sample at each of the corners and sometimes more) you subdivided the world into.

So you now have this 3d grid around you of "something exists here" and "this doesn't have anything here".

Places where there is a transition from "nothing" to "something" or from "transparent something<->solid something" are where the surfaces are. There's then a couple of different algorithms for producing polygons that roughly follow these surfaces - the most famous being marching cubes.

You then just shove the big mess of polygons into UE4 or Unity and job's done. A close friend did the last step, starting with an open source voxel library and shoveling it into UE4.

So, ok, suppose you want to add and subtract from this world.

You want to add a flat plate. Smooth this world out. So this is a new equation, defined to exist at the plate, and the coordinates of where the plate is in the world determine which of the "cubes" contain a reference to this equation.

You want to subtract a cone-shaped crater. Similar, but now you take any points that fall inside the cone and if they are currently inside something, you change them to being inside void.

As I understand it, there's a way to sample a whole buncha times in a surface and to replace a series of unions and diffs with many additions and subtractions with a simple one. Called like "hermite data" or something. Or have a rule that only a finite number of changes are permitted in volume and you merge the 2 equations with the smallest volumes.

There is a huge amount of information dating back several years on the blog of VoxelFarm's founder (he used to work on procedural planets, so I've followed him a while).

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

This topic is closed to new replies.

Advertisement