Problem reg. index_buffer_stride on bezier-mesh with Sbvh and Trbvh-Acceleration


I’m trying to render quadratic bezier-meshes, but I’m getting empty images when using Sbvh and Trbvh acceleration. Is it necessary to also define vertex_buffer_stride, when using index_buffer_stride=4?

The bezier-triangles are each defined by six entries in index_buffer, alternating between corner- and control-points. The ordering of the vertex_buffer may be considered as undefined, so I can’t set vertex_buffer_stride.

I get good images when using NoAccel or Bvh as acceleration structures, so my bezier_bounds() and bezier_intersect() functions seem correct.

I tried setting index_buffer_stride=4 (int32 values), so that the control points are skipped, and only the three corner vertices of the triangles are used for acceleration purpuoses. This results in empty images.

When I create a second index-buffer, containing only the three corner vertices, and use this with stride=0 to create the acceleration structure, I get valid images. I would rather not use this kludge because of data duplication, but this shows that using flat triangles for acceleration (as also used in the last paragraph) should be ‘enough’.

Also, when I place any other geometry (simple box) in the same group/acceleration, I get a valid rendering. This is interesting, but also an poor solution.

Do I need vertex_buffer_stride? Why does adding a simple box solve this problem?

Am I using index_buffer_stride wrong? If I understand correctly, the index_buffer_stride=4 method and the second index_buffer method should give identical results. Is this maybe a bug in the acceleration-generation?

Cheers and thanks,

1 Like

The problem is most likely that you use “vertex_buffer” and “index_buffer” as names and/or set the Trbvh and Sbvh acceleration properties to select the specialized triangle builders. Do not do that when implementing custom geometric primitives or if your vertex attributes or indices are not matching the expected format or layout!
Or if these are actually triangles, your strides are wrong.
Find more information here: