VoxelMesherCubes
Generates a cubic voxels mesh from colors.
Generates a cubic voxels mesh from colors.
Builds meshes representing cubic voxels, based on color values stored in the VoxelBuffer.ChannelId.ChannelColor channel.
Colors will usually be stored in the COLOR vertex attribute and may require a material with vertex colors enabled, or a custom shader.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
VoxelMesherCubesConstructor
public VoxelMesherCubes();Properties5
ColorModeProperty
public VoxelMesherCubes.ColorModeEnum ColorMode { get; set; }Sets how voxel color is determined when building the mesh.
GreedyMeshingEnabledProperty
public bool GreedyMeshingEnabled { get; set; }Enables greedy meshing: the mesher will attempt to merge contiguous faces having the same color to reduce the number of polygons.
OpaqueMaterialProperty
public Material OpaqueMaterial { get; set; }Material that will be used for opaque parts of the mesh.
PaletteProperty
public VoxelColorPalette Palette { get; set; }Palette that will be used when using the VoxelMesherCubes.ColorModeEnum.MesherPalette color mode.
TransparentMaterialProperty
public Material TransparentMaterial { get; set; }Material that will be used for transparent parts of the mesh (colors where alpha is not set to max).
Methods8
GenerateMeshFromImageMesh
public static Mesh GenerateMeshFromImage(Image image, float voxelSize);Generates a 1-voxel thick greedy mesh from pixels of an image.
| Name | Type | Default |
|---|---|---|
image | Image | — |
voxelSize | float | — |
MeshGetColorModeVoxelMesherCubes.ColorModeEnum
public VoxelMesherCubes.ColorModeEnum GetColorMode();VoxelMesherCubes.ColorModeEnumGetPaletteVoxelColorPalette
public VoxelColorPalette GetPalette();VoxelColorPaletteIsGreedyMeshingEnabledbool
public bool IsGreedyMeshingEnabled();boolSetColorModevoid
public void SetColorMode(VoxelMesherCubes.ColorModeEnum mode);| Name | Type | Default |
|---|---|---|
mode | VoxelMesherCubes.ColorModeEnum | — |
SetGreedyMeshingEnabledvoid
public void SetGreedyMeshingEnabled(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetMaterialByIndexvoid
public void SetMaterialByIndex(VoxelMesherCubes.Materials id, Material material);Sets one of the materials that will be used when building meshes. This is equivalent to using either VoxelMesherCubes.OpaqueMaterial or VoxelMesherCubes.TransparentMaterial.
| Name | Type | Default |
|---|---|---|
id | VoxelMesherCubes.Materials | — |
material | Material | — |
SetPalettevoid
public void SetPalette(VoxelColorPalette palette);| Name | Type | Default |
|---|---|---|
palette | VoxelColorPalette | — |
VoxelMesherCubes.ColorModeEnum
| Value | Description |
|---|---|
MesherPalette = 1 | Voxel values will be interpreted as indices within the color palette assigned in the |
Raw = 0 | Voxel values will be directly interpreted as colors.
8-bit voxels are interpreted as |
ShaderPalette = 2 | Voxel values will be directly written as such in the mesh, instead of colors.
They are written in the red component of the |
VoxelMesherCubes.Materials
| Value | Description |
|---|---|
Count = 2 | Maximum number of materials. |
Opaque = 0 | Index of the opaque material. |
Transparent = 1 | Index of the transparent material. |