You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey I'm trying to make low poly rocks in UE5 with random points generated and convex hull calculated around them. Everything works perfectly except that it always generate one triangle less (see picture below).
In code I just take all the vertices generated in BluePrint (UE5 procedural language), populate them into point cloud (as described in readme) and remap back to structure that I use to describe triangles. It happens with any seed. The vertices of empty triangle seem to have random indexes. So far I can work with that by rotating a rock that the empty triangle faces the ground but can be frustrating for future users.
Attachments
Code
#include"ConvexHullGenerator.h"
#include"LowPolyGame/External/QuickHull/QuickHull.hpp"
TArray<FIntVector>& UConvexHullGenerator::CalculateConvexHull(TArray<FVector>& Vertices)
{
quickhull::QuickHull<float> qh;
std::vector<quickhull::Vector3<float>> PointCloud;
for (constauto Vertex : Vertices)
{
quickhull::Vector3<float> V3(Vertex.X, Vertex.Y, Vertex.Z);
PointCloud.push_back(V3);
}
auto Hull = qh.getConvexHull(PointCloud, true, true);
constauto Result = new TArray<FIntVector>();
constauto IndexBuffer = Hull.getIndexBuffer();
float Buffer[3];
for (int i = 0; i < IndexBuffer.size(); i++)
{
if (i > 0 && i % 3 == 0)
{
FIntVector Vector = FIntVector(Buffer[0], Buffer[1], Buffer[2]);
Result->Add(Vector);
}
Buffer[i % 3] = IndexBuffer[i];
}
return *Result;
}
Preview
The text was updated successfully, but these errors were encountered:
Hey I'm trying to make low poly rocks in UE5 with random points generated and convex hull calculated around them. Everything works perfectly except that it always generate one triangle less (see picture below).
In code I just take all the vertices generated in BluePrint (UE5 procedural language), populate them into point cloud (as described in readme) and remap back to structure that I use to describe triangles. It happens with any seed. The vertices of empty triangle seem to have random indexes. So far I can work with that by rotating a rock that the empty triangle faces the ground but can be frustrating for future users.
Attachments
Code
Preview
The text was updated successfully, but these errors were encountered: