Submesh border?

Hi everyone!

Having mesh with dynamic submeshes.
Not textured. Only colored meshes.

How can i mark submesh border points?

What do you mean by “mark submesh border points”? Are you asking for a way to draw a line of some kind where two submeshes meet? And presumably, because you’re asking this in the shader subforum, you’re also asking how to do this with a shader.

The answer is you can’t. It’s impossible to mark the border between submeshes with a shader since shaders don’t know about submeshes. Realistically, a shader only ever knows about a single vertex or a single pixel at a time. Even tessellation & geometry shaders only know about a single input triangle at a time. And that’s for a single mesh; even if there was a way to know about more than just a triangle at a time, as far as a GPU is concerned each submesh is a completely separate thing. The “sub” part of the submesh is purely a CPU side construct.

So, solutions:

  • On the border between your submeshes, manually build a line strip submesh in c#.
  • Use a custom post process edge detection shader.
  • Mark the edge vertices with some kind of vertex property when constructing the mesh and use a custom shader that draws a line there (see wireframe shaders).