Jump to content
  • Advertisement
Sign in to follow this  

Fully destructible environment not limited to cubes

This topic is 1065 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.  

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!