Closed kinnexus closed 1 year ago
It's not intentional, I try to solve several times and I can't achieve it. I think is a problem related with the noise and the terrain or maybe the interpolation.
Looking through the code this evening, I’m guessing that the problem is in this function
public float3 interporlateVertex(float4 p1, float4 p2, out float interpolation) { interpolation = (isoLevel - p1.w) / (p2.w - p1.w); return math.lerp(new float3(p1.x,p1.y,p1.z), new float3(p2.x,p2.y,p2.z), interpolation); }
Specifically, I’m not sure that isoLevel is doing what you want it to, or perhaps you are sending in the wrong p1/p2 vertices. You are getting different vertex values for adjoining voxels that should have the same vertex value, which makes me think that the interpolation is giving a wrong outcome.
I’ll keep looking
From: Javier Garzo @.> Sent: Friday, September 9, 2022 12:31 PM To: Javier-Garzo/Marching-cubes-on-Unity-3D @.> Cc: Greg Coleman @.>; Author @.> Subject: Re: [Javier-Garzo/Marching-cubes-on-Unity-3D] Is the overhang right above slopes expected? (Issue #14)
It's not intentional, I try to solve several times and I can't achieve it. I think is a problem related with the noise and the terrain or maybe the interpolation.
— Reply to this email directly, view it on GitHubhttps://github.com/Javier-Garzo/Marching-cubes-on-Unity-3D/issues/14#issuecomment-1242197654, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEH6HEHJ5KYSWH2HG4PTOE3V5NQ43ANCNFSM6AAAAAAQIY44V4. You are receiving this because you authored the thread.Message ID: @.**@.>>
I investigate about the problem and its related to a mix of the way of calculating the interpolation of the vertices, and the way to set the vertex weight of the surface of the terrain and the air ones. I am looking for a solution.
Well, after a ton of debug I have a pretty good idea what your code does and while I’m not 100% happy with this solution, it’s much, much better than where it was last week.
In your biome terrain generators try setting the lastVertexWeigh without adjusting for isoLevel, like so
int lastVertexWeigh = (int)(255 * ( height % 1));//Weigh of the last vertex
This gets a reasonably smooth interpolation. I settled on this because the terrain adjustment routines hooked to the mouse buttons do the same thing; they use the entire byte range 0 to 255 rather than adjusting for isoLevel and they get nice, smooth interpolation.
From: Javier Garzo @.> Sent: Sunday, September 11, 2022 3:25 PM To: Javier-Garzo/Marching-cubes-on-Unity-3D @.> Cc: Greg Coleman @.>; Author @.> Subject: Re: [Javier-Garzo/Marching-cubes-on-Unity-3D] Is the overhang right above slopes expected? (Issue #14)
I investigate about the problem and its related to a mix of the way of calculating the interpolation of the vertices, and the way to set the vertex weight of the surface of the terrain and the air ones. I am looking for a solution.
— Reply to this email directly, view it on GitHubhttps://github.com/Javier-Garzo/Marching-cubes-on-Unity-3D/issues/14#issuecomment-1243026987, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEH6HECYI5TUNM6WGEHKRJLV5YW2HANCNFSM6AAAAAAQIY44V4. You are receiving this because you authored the thread.Message ID: @.**@.>>
Sorry for no find a solution a try changing the interpolation algorithm from bilinial to lineal, and other solutions in the same part of the biomes (all code related with the lastVertexWeigh). And a busy month.
I see your solution as the current best , but it need to solve the problems with the paint of the terrain.
There is also a strange generation in the height differences
However , it's a more organic solution. Good job.
I have really enjoyed looking through this project, but it seems that there is an overhang that appears immediately above slopes like the image above. These overhangs look a little strange, but they also interfere with a character attempting to walk up these slopes. Is that overhang intentional?