VoxelMesherBlocky
Produces a mesh by batching models corresponding to each voxel value, similar to games like Minecraft or StarMade.
Produces a mesh by batching models corresponding to each voxel value, similar to games like Minecraft or StarMade.
Occluded faces are removed from the result, and some degree of ambient occlusion can be baked on the edges. Values are expected to be in the VoxelBuffer.ChannelId.ChannelType channel. Models are defined with a VoxelBlockyLibrary, in which model indices correspond to the voxel values. Models don't have to be cubes.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
VoxelMesherBlockyConstructor
public VoxelMesherBlocky();Properties10
LibraryProperty
public VoxelBlockyLibraryBase Library { get; set; }Library of models that will be used by this mesher. If you are using a mesher without a terrain, make sure you call VoxelBlockyLibraryBase.Bake before building meshes, otherwise results will be empty or out-of-date.
OcclusionDarknessProperty
public float OcclusionDarkness { get; set; }OcclusionEnabledProperty
public bool OcclusionEnabled { get; set; }Enables baked ambient occlusion. To render it, you need a material that applies vertex colors.
ShadowOccluderNegativeXProperty
public bool ShadowOccluderNegativeX { get; set; }When enabled, generates a quad covering the negative X side of the chunk if it is fully covered by opaque voxels, in order to force directional lights to project a shadow.
ShadowOccluderNegativeYProperty
public bool ShadowOccluderNegativeY { get; set; }When enabled, generates a quad covering the negative Y side of the chunk if it is fully covered by opaque voxels, in order to force directional lights to project a shadow.
ShadowOccluderNegativeZProperty
public bool ShadowOccluderNegativeZ { get; set; }When enabled, generates a quad covering the negative Z side of the chunk if it is fully covered by opaque voxels, in order to force directional lights to project a shadow.
ShadowOccluderPositiveXProperty
public bool ShadowOccluderPositiveX { get; set; }When enabled, generates a quad covering the positive X side of the chunk if it is fully covered by opaque voxels, in order to force directional lights to project a shadow.
ShadowOccluderPositiveYProperty
public bool ShadowOccluderPositiveY { get; set; }When enabled, generates a quad covering the positive Y side of the chunk if it is fully covered by opaque voxels, in order to force directional lights to project a shadow.
ShadowOccluderPositiveZProperty
public bool ShadowOccluderPositiveZ { get; set; }When enabled, generates a quad covering the positive Z side of the chunk if it is fully covered by opaque voxels, in order to force directional lights to project a shadow.
TintModeProperty
public VoxelMesherBlocky.TintModeEnum TintMode { get; set; }Configures a way to apply color from voxel data.
Methods10
GetLibraryVoxelBlockyLibraryBase
public VoxelBlockyLibraryBase GetLibrary();VoxelBlockyLibraryBaseGetOcclusionDarknessfloat
public float GetOcclusionDarkness();floatGetOcclusionEnabledbool
public bool GetOcclusionEnabled();boolGetShadowOccluderSidebool
public bool GetShadowOccluderSide(VoxelMesherBlocky.Side side);| Name | Type | Default |
|---|---|---|
side | VoxelMesherBlocky.Side | — |
boolGetTintModeVoxelMesherBlocky.TintModeEnum
public VoxelMesherBlocky.TintModeEnum GetTintMode();VoxelMesherBlocky.TintModeEnumSetLibraryvoid
public void SetLibrary(VoxelBlockyLibraryBase voxelLibrary);| Name | Type | Default |
|---|---|---|
voxelLibrary | VoxelBlockyLibraryBase | — |
SetOcclusionDarknessvoid
public void SetOcclusionDarkness(float value);| Name | Type | Default |
|---|---|---|
value | float | — |
SetOcclusionEnabledvoid
public void SetOcclusionEnabled(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetShadowOccluderSidevoid
public void SetShadowOccluderSide(VoxelMesherBlocky.Side side, bool enabled);| Name | Type | Default |
|---|---|---|
side | VoxelMesherBlocky.Side | — |
enabled | bool | — |
SetTintModevoid
public void SetTintMode(VoxelMesherBlocky.TintModeEnum mode);| Name | Type | Default |
|---|---|---|
mode | VoxelMesherBlocky.TintModeEnum | — |
VoxelMesherBlocky.Side
VoxelMesherBlocky.TintModeEnum
| Value | Description |
|---|---|
None = 0 | Only use colors from library models. |
RawColor = 1 | Modulate voxel colors based on the |