Categories: Misc

UE – Voxel Forge Plugin Tutorial

Table of Contents

VoxelForge Plugin Documentation (Unreal Marketplace - WIP)

Open Unreal Marketplace (WIP)

Language: >English< | 中文

Preface: This plugin implements Minecraft-style voxel rendering in UE.

Quick Start

To quickly create a voxel world, use the VoxelForgeSubsystem class. Call its Create Level function in Blueprints or C++.
Prerequisite: Configure global settings using Set Voxel Global Setting Override.

  1. Material: Use the default material Material/M_VoxelChunkInstance from plugin content.

  2. Texture Resource Setting:

    • For Texture2D Arrays: Assign to Texture Array parameter and disable Use Outside Directory Textures. A sample array is provided in Material folder.
    • For external PNG textures: Enable Use Outside Directory Textures and specify path in Outside Directory Textures Path. Example:
      D:\\Project\\AstralReactor\Plugins\\VoxelForge\\Resources\\DefaultTextures\\ (Use absolute path or relative path).
      Set Outside Texture Size X/Y according to texture dimensions. Use "Nearest" filter for Minecraft-style sampling.
  3. Block Register: Use provided BP_DefaultBlockRegister (customization explained later).

After configuration, call Create Level with parameters:

  • Save path
  • Level name
  • Pre-generation range (chunks to generate/load at startup)

Launch PIE to see generated world:

Player Setup

Actors with Voxel Player Component gain chunk loading/unloading capabilities.

  1. Add Voxel Player Component to your player blueprint
  2. Call Update Surrounding Chunks (no need for Tick call - smart throttling included)
    Sample implementation in Template/VoxelPlayer:


    Adjust view distance in component details:

World Interaction

Key functions:

  1. Voxel Line Trace: Returns hit block position and ID.

    • Outside Pos: When enabled, returns adjacent position for block placement
  2. Set Block Immediately: Updates block at world position. Predefined IDs:
    Vanilla::Air, Vanilla::Grass, Vanilla::Stone, Vanilla::Log, Vanilla::Leaf

Block Registration

Create Blueprint child of Voxel Block Register and override in global settings.
Each block requires:

  • Unique Namespaced ID (e.g., Vanilla::Grass)
  • Block Type (Block or Air)
  • Face UV indices (X coordinate = texture array index)

Texture Ordering: For external textures, name files numerically (e.g., 00001-GrassSide.png) to ensure correct array indexing.

C++ Registration: Add built-in blocks in VoxelForgeSubsystem.cpp line:133:

SetVoxelBlock({TEXT("Vanilla"), TEXT("Grass")}, FBlock_Grass());
SetVoxelBlock({TEXT("Vanilla"), TEXT("Stone")}, FBlock_Stone());

Remove corresponding entries from Blueprint registers after C++ implementation.

同步Sch

Share
Published by
同步Sch

Recent Posts

Blueprint Enchant tutorial

Language: 中文 | >English< Introduction This library currently includes over 60 new blueprint nodes and…

8 months ago