theSoenke / ProceduralTerrain

Procedural voxel terrain generation in Unity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deformable terrain ?

cemkoker opened this issue · comments

commented

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

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
commented

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 ?

commented

Please heeeeelp @theSoenke :)

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

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

commented

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

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

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

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

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.

commented

hi @itstilllags would you mind sharing your progress ?