Voxel Plugin

That one works! The only world generator working is the flat one though, the test and sphere ones don’t show anything but the chunks are still being generated.

That’s because by default sphere radius is 0. You can create a custom sphere world generator by creating a blueprint class inheriting from SphereWorldGenerator, and then you can set radius.

Edit: Radius was not taken into account, fixed that in latest version

Landscape importer (colors can be replaced by any material):

Great job, thank you for sharing the code!
The dynamic mesh importer is awesome, I see that the lag is due to raycasts and they can be precomputed - does it mean that they could be somehow precomputed for every static mesh to minimize the lag? Let’s say that I would like to dynamically import meshes (just like the car mesh in the video) in-game, but minimize the lag… Would something like this be possible?

The raycasts could be done in editor, creating a voxel asset which could then be imported at runtime without any lag.

Thanks for the answer, that sounds promising. So basically [static mesh] -> [convert to a special voxel asset with all raycasts precomputed] -> [import it as voxel asset at runtime]? Is it already possible in current state of the project?

That’s a great learning resource by the way, voxels were always on my to-learn list. Thank you again!
Keep it up!


Not yet

Runtime mesh import:

This is really looking pretty cool, and I’m excited to check it out. I too am having the same build error as HeroicVillian. I created a fresh C++ project and added the latest plugin from github. Attempting to build the plugin fails. I generated the VS project files and tried building in Visual Studio and here are the errors:

1>------ Build started: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>------ Build started: Project: VoxelTest, Configuration: Development_Editor x64 ------
2> Performing 4 actions (18 in parallel)
2> Module.Voxel.cpp
2>X:\Unreal\VoxelTest\Plugins\Voxel\Source\Voxel\Private\TransvoxelTools.cpp(342): error C4800: ‘int’: forcing value to bool ‘true’ or ‘false’ (performance warning)
2>X:\Unreal\VoxelTest\Plugins\Voxel\Source\Voxel\Private\VoxelChunk.cpp(35): error C4800: 'AVoxelChunk *const ': forcing value to bool ‘true’ or ‘false’ (performance warning)
2>X:\Unreal\VoxelTest\Plugins\Voxel\Source\Voxel\Private\VoxelChunkStruct.cpp(326): error C4800: ‘int’: forcing value to bool ‘true’ or ‘false’ (performance warning)
2>X:\Unreal\VoxelTest\Plugins\Voxel\Source\Voxel\Private\VoxelChunkStruct.cpp(327): error C4800: ‘int’: forcing value to bool ‘true’ or ‘false’ (performance warning)
2>X:\Unreal\VoxelTest\Plugins\Voxel\Source\Voxel\Private\VoxelChunkStruct.cpp(362): error C4800: ‘int’: forcing value to bool ‘true’ or ‘false’ (performance warning)
2>ERROR : UBT error : Failed to produce item: X:\Unreal\VoxelTest\Plugins\Voxel\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-Voxel.lib
2> Total build time: 15.92 seconds (Local executor: 0.00 seconds)
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(41,5): error MSB3075: The command “X:\Unreal\UE_4.17\Engine\Build\BatchFiles\Build.bat VoxelTestEditor Win64 Development “X:\Unreal\VoxelTest\VoxelTest.uproject” -waitmutex” exited with code 5. Please verify that you have sufficient rights to run this command.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Anyone know how to blend triplanar materials based on height on a sphere? I’m trying to make craters and holes turn to gravel.
@Filmburner I fixed that by compiling in editor, but I’m not sure if it’s actually compiling

@HeroicVillain You could set color based on height, and use this color to lerp between textures (see the VoxelMaterial folder). However materials are currently limited to 4 (one for each channel: R G B A).

@Filmburner Try upgrading to Visual Studio 2017, C4800 has been removed from it and this is the version I’m using (so I’m not getting the error).

@Phyronnaz Hi. I felt in love with your work. It’s reall good and this is what I’m looking for a long time. Just I want to know a few things about this plugin’s future.

Will you add more layer slot?

And I’m using pretty big open world map and I want to turn it into voxel. Right now, I’m far away from my computer and I don’t have a chance to try it, so if I use this plugin for my big open world map, would it affect the performance a lot?

Thanks for this wonderful plugin. (:

@Emrehan Thanks for feedback!

Yes. Right now the problem is not the slots, it’s the material rendering system which only supports up to 4 materials. I need to rewrite part of the rendering system to allow support for up to 128 (maybe 256) materials.

Can’t say for sure.
Rendering should be fine, but I need to work on improving performance when moving. I’d say you can easily say above 60fps if your material isn’t too complex.
Importing it may crash the editor.

I’ll probably update to 2017 soon, but I also fixed the build errors by enclosing the int to bool conversions with ( int_variable ) != 0

Great work! Thanks for sharing the sourcecode. But I think theres a bug at LandscapeWorldGeneratorDetails line 137 souldnt it be Weightmap4.Num()?
@Filmburner you can also use the #pragma warning(disable:4800) … #pragma warning(default:4800) to make your project compile successfully

@EagleOwl Thanks! If you find more bugs, please report them on github, should be easier for tracking.

Render system now blends between 2 materials, allowing for up to 256 materials. LandscapeWorldGenerator has also been updated and can use up to 256 layer slots.

Is this really terrain editing while players play the game or is it in editor only? what version is it made for? i have 4.15 4.16 4.17 and none can compile it?

Hey Phyronnaz, could you add an example map with procedural generation?

I played around with it, but im not getting any useable results… :stuck_out_tongue:

thanks for all your work!