#Procedural mesh generation system creating artifacts

9 messages · Page 1 of 1 (latest)

digital cairn
#

I'm trying to write a mesh generation system for a chunked voxel world, however, I'm experiencing weird artifacting that I can't track down the source of. I've attached some images to give you an idea of what this looks like.

I've tried several things, and I believe I've tracked down the issue to the code that decides whether to create the faces for each side of a block or not.
Performing len() on the Vec storing my position values after a code modification setting every face to generate results in the following: 147456
This is exactly what my calculations say it should be, so I don't think there's a problem with that. I'm not experienced enough to say whether or not this is actually true, or if this is a purely visual issue.
I'm not even sure if this is really related to Bevy, other than it outputting to a Bevy result and being displayed by Bevy, however I'm hesitant to post this on the Rust discord since it may be unsuitable.

My generation code is all here: https://github.com/Veritius/rustcraft/blob/af5267372c983dcc81a5f403759fc719e9d14547/modlib/src/world/chunk/meshing/mod.rs
I'm aware my indentation practices among others aren't particularly good.

GitHub

A little test of a Minecraft-like voxel world in Rust - rustcraft/mod.rs at af5267372c983dcc81a5f403759fc719e9d14547 · Veritius/rustcraft

cloud rampart
#

on line 90 https://github.com/Veritius/rustcraft/blob/af5267372c983dcc81a5f403759fc719e9d14547/modlib/src/world/chunk/meshing/mod.rs#L90 you check the block above
this_block_pos + IVec3 { x: 0, y: 1, z: 0 }
but then add the front face

      POS_IDX_A, POS_IDX_E, POS_IDX_B,
      POS_IDX_E, POS_IDX_F, POS_IDX_B,
  ], offset));
GitHub

A little test of a Minecraft-like voxel world in Rust - rustcraft/mod.rs at af5267372c983dcc81a5f403759fc719e9d14547 · Veritius/rustcraft

#

and in your comment you say its the back face?

#

and on line 102 you say its the front face, but on 103 you check y-1, which is the bottom, and then add the back face HDC GHC

#

x goes from left (negative) to right (positive)
y goes from down(negative) to up (positive)
and z goes from back(negative) to forward/front(positive)

digital cairn
#

I'll have a look - I was wondering if I mistyped the coordinates. I'm more used to thinking in a Z-up pattern, for some reason.

#

I'll look more thoroughly through the selection code tomorrow, as it's midnight over here.

digital cairn
#

While my coordinates were incorrect, the anomalies remain. I'm really not sure what's happening here.

#

Notably, it only seems to happen when blocks are adjacent, and not just on chunk boundaries. Singular blocks work fine.