Ue4 TiledMap Generation in 3d - grid

How i can generate a Island shaped 2d Map with tiled cubes? Does someone can give me tipps or links or some other help please?
I already tried it with Noise but it ends in weird results cause i dont get how i use it in a 2d way.
Also i tried to give each tiles numbers so i knew what was the last placed tile.
But that ended in a big Chaos.
What i dont understand right now is how to "move" in that grid or how to know what was last and what could be the next and ye.
I really guess there is a simple way to handle that all which i dont realize at the moment?
I work for right now only with BP.
Thanks

Related

2D space organic projection

I'm currently working on a glsl shader (EDIT : I'm starting to think that a shader isn't necessarily the best solution and as I'm doing this in processing, I can consider a vectorial solution too) supposed to render something like this but filling the entire 2D space (or at least a larger surface):
To do so, I want to map the repeating patterns on the general leaves shapes that you can see on the top of the sketch below.
My problem is this mapping part : is it possible to find a function that project XY coordinates on the screen to another position in such a way that I can map my patterns the way I want? The leaves must have some kind of UV coordinates inside them (to be able to apply the repeating pattern) and the transformation must be a conformal map because otherwise, there would be some distortions in the pattern.
I've tried several lines of thought but I haven't managed to get the final result :
recursion :
the idea is to first cut the plane in stripes, then cut the stripes in leaves shapes that touch the top and the bottom of the stripes (because that's easier) and finally recursively cut the leaves in halves until the result looks more random. as long as the borders of the stripe aren't on the screen, it shouldn't be too noticeable. The biggest difficulty here is to avoid the distortion.
voronoi :
it may be possible to find a distance function guided by a vector field such that the Voronoi diagram looks more like what I'm looking for. However I don't think it will be possible to have the UV mapping I want. If it's the case, a good approximation woult do the trick, the result doesn't need to be exact as long as it isn't too noticable.
distortion :
it could also be possible to find a more direct way to do this projection. While desperately looking for a solution, I came across the fact that a continuous complex function is a conform map but I haven't managed to go any further.
Finaly, there may be another solution I haven't thought about and I would be glad if someone gave me a complete solution or just a new idea I haven't tried yet.

Is there a formula to find affected square by sized-brush on a grid?

I am not sure how to put this problem in a single sentence, sorry if the title is misleading.
I am currently developing a simple terrain editor with a circle-shaped brush size. The image below shows a few cases that represent my problem.
additional info: the square size is fixed and uniform and in the current version, my concern is only to find which one is hit and which one is not (the amount of region covered is important for weighting the hit, but probably not right now)
My current solution (which is not even correct for a certain condition) is: given a hit in a position (x, y) with radius r, loop through all square from (x-radius, y-radius) to (x+radius, y+radius) and apply 2-D box to circle collision detection. But I don't think this is optimal (or even correct IMO).
Can anyone help me with this one? Thank you
Since i can't add a simple comment due to bureaucracy on this website i have to type it out here.
Anyway you're in luck since i was trying to do this recently as well! The way i did it is i iterated through the vertex array and check if the current vertex falls inside the radius of the circle. But perhaps what you want is to check it against each quad center and if that center falls inside the radius then add the whole quad as it's being collided.
Of course depending on the size of your grid the performance will vary so it's good to try to iterate through as few quads as needed. Though accessing these quads from the array is something you have to figure out yourself.

NetTopologySuite squash multipolygon to polygon

I am working in aspnetcore using the most up to date GeoAPI and NetTopologySuite version for core. What I'm trying to do should be fairly simple but I can't seem to find the proper way to do it either through experimentation of googling. Or even what to call it, to be honest, which makes googling harder.
Hopefully someone can kick me in the right direction.
I have a multipolygon which may be made up of one or more polygons. I want to create a buffer around that multipolygon's points out to X distance. This is basically a map overlay with concentric areas of interest. A given point of interest may fall in the original multi polygon's shapes... or it might fall in the first or second buffer area. Kinda like an onion if the core of an onion had random shapes in it.
That first part is simple. Just iterate the multipolygon's points and apply a buffer to each point using the buffer method:
var bufferZonePoints = new List<IGeometry>();
foreach(var point in multiPolygon.Coordinates)
{
bufferZonePoints.Add(point.Buffer(x));
}
var bufferZone = this.geometryFactory.CreateMultiPolygon(bufferZonePoints);
That's fine. But it's giving me another multipolygon made up of thousands of points. When I use this as a map overlay, I get a hurricane of circles following the vague outlines of the original shape sort of looking like a spirograph drawing. All I want is basically the outer boundary of all the buffer circles without all the points in the center.
I tried doing a ConvexHull on the multipolygon and it looked correct at first until I realize that it was shaving off the angles on the outside in order to get the smallest polygon all those points fit into (which is what convex hulls do after all). But that causes problems in the stuff I'm overlaying. Some points of interest may be outside the actual buffer, but be inside if the convex hull decides to round off a bumpy area of the zone. (I hope that makes sense).
Basically what I'm trying to do is take that multipolygon made up of all those buffered points and squash it down into a single polygon made up all the outermost boundaries of the buffers. But without all the spirograph garbage in the middle. I don't really want a ConvexHull. I've also tried Union and the GeometryCombiner class, but none of these are doing what I want.
I don't know if this helps makes this mud any clearer but there is a setting in QGIS that when you plunk down two circles and the circles would overlap they combine into one big blob like soap bubbles and the boundaries in between vanish. That's kinda what I'm trying to do via code.
Does that make sense? Can anyone help?
After continuing to experiment with my mapping tool. It would appear that Union DOES actually give me the result I wanted.
I started with two polygons that were far enough apart to make it obvious what was going on, did a union on them and got back just the shell of the combination of them. As I added more of the buffered points to it, the shame became a bit more obvious.
That's pretty well what I wanted.
Thanks anyway though! Hopefully this will help someone else.

Generating eroded mountain terrain in a local / 'bottom-up' way

I'm picturing a typical random polygon hillside with ridges that come together into bigger ridges as you ascend and canyons that come together into bigger canyons as you descend.
The way you normally make something like this is to start with the top of the whole mountain and iterate until you have enough detail in the area you're interested in and then stop.
OK, suppose there is no absolute mountain top; it just keeps going; and I want to generate the neighboring chunk before I get to it so it matches up with what is already there.
After thinking about it for a while I think this is probably either impossible or involves a kind of math I haven't even heard of. On the other hand it -seems- like it 'should' be possible, (with extra information stored per-vertex)?
Maybe try doing it in 2D first and see what you can come up with.
It looks possible in 2D, in 3d it would work too but not with a real mountain with a top, more with an endless slope that does not converge to a point.
What you want to do is actually reversing the gravity rules in some sense.
Not sure if this is really an answer, but the question is quite vague too :)

Get angle for ear clipping

I am trying to implement a ear clipping algorithm into a program of mine but I am having issues. While that I can get it to work in a lot of situations, I haven't found a good way to check for reflex angles.
I've been looking up ways - every method I've tried to date seems to have angle it won't work for. When I try to find more information, most people's tutorials/work just tell me to "find the reflex angle and test for ear" then describe how to test for ear but not how to get the reflex angle.
Can anyone tell me how to get the proper angle inside the triangle for a concave polygon, or point me in the right direction? Could be an understanding issue with me. Thanks.
Figured out my problem was one of how I was conceiving the issue. I was saying that if the point was outside the polygon it could still be in the polygon without adding in my head the fact I removed the last vertex. Been busting my brains trying to implement ear clipping for a few days and got it wrong at this point - the solution was the basic "check if the center point of the triangle was outside the polygon and mark it as reflex".

Resources