Awesome
3D Perlin noise using marching cubes algorithm
About:
This component allows you to generate 3D Perlin Noise mesh with collisions in runtime in unreal engine.
Requirements:
In order for this component to work you will need:
- Unreal Engine 4 2.5 (2.6 is yet not supported by RuntimeMeshComponent so you need to use 2.6 or update RuntimeMeshComponent to 2.6)
- Runtime mesh component - In order to create a mesh (Marketplace)
- PerlinNoiseComponent - In order to get noise values (This component comes bundled in this repo)
Installation:
- Install the RuntimeMeshComponent
- Add libnoise library to your UE4 project. You can find how in this repo by nialna. P.S. - in the git history of this repo you can find installed version of libnose.
- Copy PerlinNoiseComponent.h and PerlinNoiseComponent.cpp to your
Source
folder. This component was made by nialna, thanks a lot to her! - Copy MCubeComponent.h and MCubeComponent.cpp to your
Source
folder. (You can also copy MCubeActor.h and MCubeActor.cpp which is an Actor example) - Add
UMcubeComponent, URuntimeMeshComponentStatic
andUPerlinNoiseComponent
to your actor. SetNoise
andRuntimeMesh
variables forUMcubeComponent
. - Call
GenerateMarchingCubeMesh()
ofUMcubeComponent
to generate the mesh!
Screenshots:
FAQ:
1) Does the mesh have collisions?
YES, but you can disable them in MCubeComponent.cpp RuntimeMesh->CreateSectionFromComponents(0, 0, 0, Vertices, Triangles, Normals, UV, VertexColors, Tangents, ERuntimeMeshUpdateFrequency::Infrequent, true);
by setting the last argument to false
.
2) Can you use it as a Terrain?
Yeap, but I recomend you for this purpouse to use Voxel plugin which is cool as shit
Credits:
- Thanks a lot to all the people who created/contributed to RuntimeMeshComponent
- Thanks a lot to nialna for her blogs and PerlinNoiseComponent
- Thanks a lot to Paul Bourke for the marching cubes article