Thank you for this!! I've been having a hard time visualizing the formulas in my head and this has been super helpful!
@steve649596 жыл бұрын
This has been a great help for me! Thanks for creating this video!
@qwertyuuytrewq8256 жыл бұрын
thk! Understood principle of work of marching cubes very fast
@huanwang3683 жыл бұрын
Thank you! This is very useful!
@zhangxaochen6 жыл бұрын
excellent animation~ THX!!
@izzahtahir7963 жыл бұрын
I want to implement in matlab how to do that
@FlashBreakerOfficial4 жыл бұрын
thx! helps me a lot :D
@fallenhoenix12556 жыл бұрын
Shouldn't the formula be t = d1 / (d2 - d1)?
@algorithmsvisualized90256 жыл бұрын
It has been a while. The sign of the samples is guaranteed to be different, if you subtracted that way then the result would be negative. Checking with a pen and paper it seemed correct as is.
@fallenhoenix12556 жыл бұрын
@@algorithmsvisualized9025 ok. Thanks!
@foxyr4bbit5 жыл бұрын
hi, one thing i don't quite understand is how do you get the vertex coordinates?
@algorithmsvisualized90255 жыл бұрын
You have a lookup table for each of the 12 edges. The table could store indices of the 2 corners and then you choose a point between those 2 corners (or middle point in the simplest case). If you add that to the min corner coordinate of current cube, you'll have the vertex coordinate. Thats one way to implement it.
@theshuman1006 жыл бұрын
Hhngh look at em cubes go
@rotcivgenerico10894 жыл бұрын
I didnt understood completely the vertex interpolation part i manager to make it work setting t = 0.5 in all cases, but how can i calculate the t value correctly? its said that "if we have a continuous field of values..." what do you mean by a "continuous field of values"?
@algorithmsvisualized90254 жыл бұрын
With marching cubes you determine the signs at the cube corners. Two corners that are on the same cube face are connected with an edge, if the signs of these corners are different it means that the surface you're trying to create must intersect at some point on that edge. The t value would be the point where the surface intersects the edge. You could use middle point of that edge where t=0.5, but most likely the intersection point wasn't exactly in the middle. The formula in video is just an approximation I've seen used a lot, definitely won't work with any data. For example imagine running marching cubes on minecraft data, a block either exists or doesn't exist, there is no value in between. 0.5 would be the best you can do knowing that on one side there exists a block and on other side there is nothing. In the video I used signed distance field of a sphere, the value changes smoothly - there is no sudden step. In that case we can make a better guess than 0.5 based on how much the value changed. The truly correct way for a sphere would be to do a raycast (ray sphere intersection) along the edge, but in practice this might be too slow. Most likely you won't use a sphere so you'd use some kind of approximation that works for your data. For example a brute force way would be to just walk along the edge with some step size until the field changes value, to do that you must have a continuous function to sample the value at every point. The method used in video is way less accurate but its fast to compute and looks better than just using 0.5 (for signed distance fields). Hope this helps
@segmentation_fault45693 жыл бұрын
Hello. How can I use your implementation of the algorithm to denote voxels? In my case, there are two kinds of voxels, empty and solid. Voxels are in a bounded cube. Your example produces a sphere, but I am unable to modify it to create a solid voxel mesh. Please tell me how this can be implemented. Thank you in advance.
@algorithmsvisualized90253 жыл бұрын
Hello In the implementation there is SampleValue function. It takes in a coordinate and outputs a value, you can return 1.0 for solid and -1.0 for empty voxel. It would also be optimal to remove the interpolation by changing line 77 to "Vector3 vertPosInterpolated = (vert1+vert2)/2.0f;" and deleting line 66-76. Hope this helps.
@segmentation_fault45693 жыл бұрын
@@algorithmsvisualized9025, Thanks for your reply. I tested this and it didn't get any results. Before that, when calculating the configuration of the cube, I set a check that the side point is less than the minimum chunk vector and that this point is not more than the maximum vector. The grid was built around the chunk.
@algorithmsvisualized90253 жыл бұрын
@@segmentation_fault4569 Make sure the volume contains a sign change. The alorithm only creates the isosurface where value is 0. So in case of a cube the volume you march has to be bigger than that cube.
@segmentation_fault45693 жыл бұрын
@@algorithmsvisualized9025 Hi. Thanks for your help! I was able to resolve this issue. Getting the configuration of the cube by its corners, I added a check to see if the voxel is empty in the angle coordinates, and also checked to see if the corner was beyond the chunk height. Everything worked as it should. If I have problems again, with your permission, I will write about it here so that other people can see the solution with my example.
@repogamesstudio23667 жыл бұрын
looks awesome ;)
@mbdesign81186 жыл бұрын
Good
@teroblepuns4 жыл бұрын
Is there a way to rotate the grid? Imagine making a spherical planet which you would want to be able to terraform as it rotates around its central axis. Yes, you could keep the planet stationary and just rotate the skybox and clouds and perhaps other planets around it, but I'm looking for a solution where someone could move the entire voxel planet while rotating it around all axis as someone is simultaneously terraforming the voxel terrain at the same time.
@brock76823 жыл бұрын
i'm sad no one has a answer...
@M4gidev Жыл бұрын
It is not possible to rotate a grid without loss of data or a huge cost of performance and memory, but it is possible to rotate the grid reading using matrix4x4 or quaternions, you apply the rotation in the coordinates to be read and interpolate the voxel values between the final coordinate, I recommend studying quarternions and signed distance field (SDF).
@austineldredge800311 ай бұрын
this answer is sorta specific to UE5, but could be applied anywhere. By creating a producedural mesh as a component seperate from the rest of the "game world" in UE5, you can create the grid so that the vertices are all relative to a parent component, in this case an invisible scene actor in the middle, rotate the parent component, you rotate all vertices in the mesh. Unreal Engine already allows this funcitonality in other mesh's as long as you're creating the mesh and not re-calculating it every scene or movement, you could theoretically do this, The cost of modify these meshes itself is expensive though, so molding a world would tie its cost directly to the resolution of the "planet" where resolution is the amount of vertices in a grid. hopefully that makes sense.
@Kyoz2 ай бұрын
🤍
@pajeetsingh4 жыл бұрын
Bruh you can speak, I won't judge you by your non-English speaking accent, Promise.