Cube terrain maybe?
Not quite First iteration of a geodesic sphere-based world generator.
Just cranking out the basic geometry then I need to sit and have a think about how best to handle subdivision and LODs.
So a planet like terrain generator?
Either way I Am looking forward to it
mid_gen, you’re an animal! Keep up the great work man, really appreciate the love you are putting into CashGen <3
This would absolutely be of interest indeed!
I would swap out my current procedural planet system for this at any time.
This morning’s efforts
@mid_gen](https://forums.unrealengine.com/member.php?5136-mid_gen) hmm… a slightly different thing: as I see and thinking, apparently on a spherical surface triangular “tiles” and “clusters” would be the best for a (RTS) pathfinder. do you have any source/article how you generated the vertices and triangles to produce the sphere? I would need it to help to determine the coordinate-tile conversions in both ways - but it will be a really far future hobby task for me (but quite interesting!) collecting tiles into areas/clusters seems to be very similar to the lod generation you use.
Just start with an icosahedron, and subdivide.
Real quick and dirty code. This is the icosahedron :
const float X = 0.525731112119133606f * aScale;
const float Z = 0.850650808352039932f * aScale;
MyVertices.Emplace(FVector(-X, 0.0f, Z));
MyVertices.Emplace(FVector(X, 0.0f, Z));
MyVertices.Emplace(FVector(-X, 0.0f, -Z));
MyVertices.Emplace(FVector(X, 0.0f, -Z));
MyVertices.Emplace(FVector(0.0f, Z, X));
MyVertices.Emplace(FVector(0.0f, Z, -X));
MyVertices.Emplace(FVector(0.0f, -Z, X));
MyVertices.Emplace(FVector(0.0f, -Z, -X));
MyVertices.Emplace(FVector(Z, X, 0.0f));
MyVertices.Emplace(FVector(-Z, X, 0.0f));
MyVertices.Emplace(FVector(Z, -X, 0.0f));
MyVertices.Emplace(FVector(-Z, -X, 0.0f));
int32 indices] = { 0,4,1, 0,9,4, 9,5,4, 4,5,8, 4,8,1, 8,10,1, 8,3,10, 5,3,8, 5,2,3, 2,7,3, 7,10,3, 7,6,10, 7,11,6, 11,0,6, 0,1,6, 6,1,10, 9,0,11, 9,11,2, 9,2,5, 7,2,11 };
MyIndices.Append(indices, ARRAY_COUNT(indices));
This is the subdivision method :
void ACGWorldFace::SubDivide(const FRuntimeMeshVertexSimple &v1, const FRuntimeMeshVertexSimple &v2, const FRuntimeMeshVertexSimple &v3, const int32 aDepth, const float aScale)
{
if (aDepth == 0) {
MyVertices.Emplace(v1);
MyVertices.Emplace(v2);
MyVertices.Emplace(v3);
MyIndices.Add(MyVertices.Num() - 3);
MyIndices.Add(MyVertices.Num() - 2);
MyIndices.Add(MyVertices.Num() - 1);
return;
}
const FRuntimeMeshVertexSimple v12 = FRuntimeMeshVertexSimple(((v1.Position + v2.Position).GetSafeNormal()) * aScale);
const FRuntimeMeshVertexSimple v23 = FRuntimeMeshVertexSimple(((v2.Position + v3.Position).GetSafeNormal()) * aScale);
const FRuntimeMeshVertexSimple v31 = FRuntimeMeshVertexSimple(((v3.Position + v1.Position).GetSafeNormal()) * aScale);
SubDivide(v1, v12, v31, aDepth - 1, aScale);
SubDivide(v2, v23, v12, aDepth - 1, aScale);
SubDivide(v3, v31, v23, aDepth - 1, aScale);
SubDivide(v12, v23, v31, aDepth - 1, aScale);
}
Thanks! icosahedron is a super sexy name
This plugin looks quite useful. Keep up the good work!
Recursive face generation.
If the number of subdivisions for a face exceeds 4, it’ll spawn 4 new faces instead. Stops each mesh getting too big.
Code is in this branch for anyone interested. I’ll probably stick it in soon though as it’s a separate Actor and doesn’t affect anything else.
Do want, looks amazing. Nice work @mid_gen
I see a sphere!
CGWorld has not yet been hooked up to the Set Up Terrain yet, right? Or am I doing something wrong?
That’s it so far
An icosasphere with independent recursively subdivided faces. I’m working on the threading part at the moment so it can start generating in realtime instead of doing it on construction.
Then I’ll get the noise hooked up :>
That’s Awesome!
I’m looking forward to what this can do for our game.
Combining PMC and RMC with multithreading in blueprints to make a 20KM universe with 10 planets, is not really optimal at all. It also has a good bit of restrictions we’re not really happy about.
I kinda want to get into C++, but yeah…
Threading achieved I assume?
Looks really nice!
This plugin is going to save our workload a ton! It’s almost too awesome!
This is exactly what we want for our game. I’m so excited to play around with this!
Hi! I’m trying to procedurally place trees, foliage, etc depending on height, slope, etc…
Is there a function somewhere that can return the (Z)-height/slope of the terrain at (X,Y)-Location?
I know I can use raycasts for this, but I was hoping that this information was already stored somewhere in code so that it would be faster than performing traces all the time.