Summary: How to render mesh’s edges without the use of indices?
To reproduce: Playground
Notes: You can adjust these two to see effects: use_indices
and render_edges
(around lines 20 and 21)
Details:
I am a beginner, and I learned from here that setting mesh._unIndexed = true might increase performance, and in my case, indices
just ranges from 0
to num_verts-1
, so it is not necessary to use indices. I must use WebGPU, because only WebGPU supports compute shaders, and my vertex positions are from the output of a compute shader.
Firstly, we can see the scene is correctly rendered without the use of indices
and edges.
However, when we turn on edge rendering, it seems that it must require indices
. By setting use_indices = false
and render_edges = true
(around lines 20, 21), we can find that the edges are not rendered, and the console throw a warning: Calling [RenderPassEncoder “MainRenderPass”].Draw with an index count of 0 is unusual. I think my code is correct, because if we additionally set use_indices = true
, the edges appears. I don’t want to set indices because it is redundant.
So my question is, can we render the edges with the following flags set?
var use_indices = false
var render_edges = true