ProceduralTerrain icon indicating copy to clipboard operation
ProceduralTerrain copied to clipboard

Deformable terrain ?

Open cemkoker opened this issue 7 years ago • 11 comments

Really nice work ! I'm wondering, how hard would it be to add a 'terraforming' option ? Like be able to dig/build the terrain ?

cemkoker avatar Dec 10 '17 13:12 cemkoker

Thanks! This should definitely be possible. Basically you would have to do the following steps:

  1. Find the chunk you want to edit
  2. Edit the the density of the chunk
  3. Rebuild the chunk to generate a new mesh

theSoenke avatar Dec 10 '17 15:12 theSoenke

Thanks, I don't see where I can edit the 'density' of the chunk; the chunk class doesn't have any variable close to that. I want to raycast from camera to a point and then dig/raise that point (and like shape it around). Can you please help me out ?

cemkoker avatar Dec 11 '17 11:12 cemkoker

Please heeeeelp @theSoenke :)

cemkoker avatar Dec 12 '17 18:12 cemkoker

Unfortunately it also has been some time since I've had a closer look at this code. And can't really tell you right away what needs to done in detail. You probably would have to edit the isosurface class. Currently it is using only 1 density object to calculate the density for each point in space. This could be extended to use a list. This way you could combine multiple surfaces. Then for each density you specify whether it a union or difference and then sum the values to create a single density value for each point

theSoenke avatar Dec 12 '17 21:12 theSoenke

I'm also interested in how to edit the terrain in that way :(

PanchoL avatar Feb 18 '18 18:02 PanchoL

me as well, this would be great for me D: if anyone figures it out let me know, ill take a look

sebastianxce avatar Feb 20 '18 09:02 sebastianxce

To do this ur going to need to store global values in chunk then modify for marching then reload and load check..

itstilllags avatar Aug 29 '18 05:08 itstilllags

I'm close... What I did was add a new voxel array to the chunk object then for marching I first calculate then resend that voxel array to chunk then after I use the parent or chunk list

itstilllags avatar Aug 29 '18 07:08 itstilllags

Hopes this helped it worked for me... I have a cheap fun ... Thank you for the source again ... When I get the time ill upload the fix

itstilllags avatar Aug 29 '18 07:08 itstilllags

Hey curious I know your busy, but I'm getting into it more, but yeah.. I notice you fixed the seams with dual contuering, however how would I send these voxels back and forth for the chunk... I can do this easily in marching cubes... But I'm not sure since contuer in g holds voxel classes but I tried and no success.. also chunk seaming when modify data of edge voxel.. I'm having issues I guess. So what I did was check for edge x==15 then wrote a new method to grab / check chunks.. then modify for x == 0 equals density of nieghboir chunk x== 16.. I could not find better... But when checking for corners of chunk all 4 voxels on each chunk almost work, however on z==15 the 16th block has a corner stuck .. hard to explain...

Thank you for the wonderful source I hope to see more of your work.

itstilllags avatar Sep 11 '18 08:09 itstilllags

hi @itstilllags would you mind sharing your progress ?

cemkoker avatar Sep 11 '18 17:09 cemkoker