last day (15 days later) » 

4:52 PM
Okay, let's change topics! Anyone else here ever implemented the marching cubes algorithm? I think there was one person who said they had last night, but I forget who.
 
@El'endiaStarman Yes sir?
@El'endiaStarman I implemented both marching cubes and squares, do you need help in it?
 
I'm trying to figure out a good way to take a collection of cubes (Minecraft-style) and turn them into smoother, polygonal surfaces.
 
Yeah, first thing you need to learn when doing a voxel-based project, that voxels aren't cubes
Minecraft isn't a voxel game, it's a voxel based game
You need to start with a 3dimensional array of values
@El'endiaStarman
 
@Bálint I do have one. They're just all 0 or 1, so it seems like the marching cubes algorithm doesn't quite apply.
 
If you want to get a blocky result, you need to use 1 or 0, if you want a more smooth mesh, then you need to have values between 0 and 1
@El'endiaStarman I assume you use a pseudo-random noise generator, don't you?
@El'endiaStarman We should create a separate discussion for this though, so it doesn't get mixed with other stuff
 
5:00 PM
@Bálint I have an idea for a 3D FPS where you fly around in spaceships, and I want to have an environment that's basically 3D Perlin/simplex noise. If I implement a noise generator, I can definitely use marching cubes. However, I already have a biased majority rule implementation that produces fairly nice terrain (you saw me post a picture of it). So I'm trying to figure out a good way to go from that to nice-ish surfaces.
I don't want high-resolution surfaces, necessarily. Just something better than cubes.
 
12
Q: 3D Least Squares Plane

SoaperGEMWhat's the algorithm for computing a least squares plane in (x, y, z) space, given a set of 3D data points? In other words, if I had a bunch of points like (1, 2, 3), (4, 5, 6), (7, 8, 9), etc., how would one go about calculating the best fit plane f(x, y) = ax + by + c? What's the algorithm for ...

 
I should note that the language I'm using is Blitz 2D/3D, which is basically a game engine, and correspondingly less powerful in terms of more-abstract data structures and the like, though it's great for graphics and interactivity.
@wizzwizz4 That wouldn't help me make meshes that approximates the cube structures.
Incidentally, @Bálint, do you know Blender?
 
@El'endiaStarman Wait, I create a separate discussion for this
So
 
Hang on, lemme move the messages over.
 
Your current algorithm can only generate 1 or 0 as values, or can it do it inbetween them
?
 
5:04 PM
Also, mind if I change this room's parent site to PPCG?
 
No, I don't
 
Huh, looks like that's not possible. Oh well. [shrugs]
 
Back to the topic: Your current algorithm can only generate 1 or 0 as values, or can it do it inbetween them?
 
19 messages moved from The Nineteenth Byte
@Bálint It's only 0 or 1 at present. Do you know the majority rule cellular automata?
 
I do
You can solve that, if you want a mesh with slopes at a 45 degrees angle
The marching cubes algorithm posted at paulborke.net contains a vertex interpolation part
Wich makes the values actually correspond to the shape of the mesh, and not just the isolevel
 
5:08 PM
You want a 3d planear regression algorithm.
 
You can remove this, and then you should get a look close to this:
@El'endiaStarman
 
Hmm, that does look fairly close to what I want.
 
Can you post your code somwhere?
 
I could put it on GitHub, yeah.
 
Then please do it
@El'endiaStarman I found a better image
The first is where no marching cubes is applied
The second is marching cubes without interpolation
 
5:13 PM
Oooh, (b) is basically exactly what I was thinking of!
 
And the third is with interpolation
Yeah
Where did you get the algorithm from?
 
For my terrain generation? It's just a biased form of 3D majority rule. That's what I'll put on GitHub.
 
No, the marching cubes
 
Oh, I don't have anything for that yet.
 
I understand
Then I don't need anything
Have you read the article at paulborke.net?
@El'endiaStarman This one: paulbourke.net/geometry/polygonise
 
5:20 PM
Yes, I have.
I'm unsure how to apply it though.
 
First, copy and paste the lookup tables, namly the edge table and the tritable
 
I can't really do that though.
 
Why?
 
This is an example of the language I'm working with.
Besides, I have a binary field. Can I not use something simpler than marching cubes?
 
Marching cubes is the simplest
@El'endiaStarman The other probability is dual contouring, but that's really hard
But do you have arrays?
 
5:26 PM
I do have arrays. Either local and 1D or global and N-D.
 
And arrays can't contain arrays?
 
That's going to be hard
 
What does N-D mean?
 
5:28 PM
N-dimensional.
 
Then you could use that, don't you?
 
I could. I still wouldn't be able to just copy-paste though.
 
What is the format of it? I can write a throwaway program for converting
 
I could too.
I'm just trying to be lazy. :P
 
Being lazy is when you create a program, to do the work for you
 
5:31 PM
hmm
 
Just tell me how an array looks like, and I do it
 
Hmm. Blitz doesn't have array literals like most languages. There is a way to do it though, but it's a feature I've never used.
But really, is there literally no simpler way to do it?
I mean, this is another example of the terrain:
 
No
 
Due to the way that majority rule CAs work, there are fewer general arrangements of cubes.
 
Sadly
@El'endiaStarman
You could make test cases, so if there's a block below and on the left, create a slope between them
@El'endiaStarman But this would require a huge amount of cases
 
5:45 PM
I did this manually in Blender, but is there any reason this couldn't be easily automated without requiring huge lookup tables?
 
I told you above, you can do it with test cases
 
Surely there's a better way.
 
But that's a lot of case
@El'endiaStarman There's 256 of them
2 of wich you don't insert a new triangle
 
I'm fairly sure this is different from how marching cubes would do it.
Sketch of an algorithm: for each empty space, look for these patterns [...] and where they exist, add a new facet in the appropriate way.
 
 
6 hours later…
11:39 PM
I've got some progress - pairs of adjacent centers now get that angled facet.
 

  last day (15 days later) »