- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I try to add hair geometry to embree (3.20)
-RTCGeometry geom = rtcNewGeometry(*g_device, RTC_GEOMETRY_TYPE_FLAT_BEZIER_CURVE);
Unfortunetely it crashes when BVH build "embree::avx::UnalignedHeuristicArrayBinningSAH<embree::PrimRef, 32ul>::computeAlignedSpace() at 0x7f82e8211a6a "
I put all vertices in an array. (vertices_radius - vec4 with radius on 4 coord).
In vertices_indices for each fiber i vertices_indices.push_back(ISPCHair(offsets, i)); ( offsets - is index position )
rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_INDEX, 0, RTC_FORMAT_UINT, &(vertices_indices[0]), 0,
sizeof(ISPCHair), fiber_count);
rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_VERTEX, 0, RTC_FORMAT_FLOAT4,
&(vertices_radius[0]), 0, sizeof(EmbreeVertex4), vertex_count);
Does fibers have to have the same number of control vertices? Or is it Embree's limitations ?
I followed tutorial. From my understanding i needed to put in vertices_indices a structure 2 unsigned int :
struct ISPCHair
{
unsigned int vertex;
unsigned int id;
} ;
where vertex is position of the vertex in vertices_radius and id is fibers index. Is it right?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looks correct to me. Maybe there is a problem with alignment. Could you please allocate a 16 byte aligned buffer for the vertices and try again?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I works !!! It was alignment problem thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just checked the code, and vertex buffers to not have to get aligned. Did you use precompiled binaries? If not, which compiler did you use to compile the code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've changed :
rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_INDEX, 0, RTC_FORMAT_UINT, &(vertices_indices[0]), 0,
sizeof(ISPCHair), fiber_count);
to :
vertices_indices = (unsigned int*) rtcSetNewGeometryBuffer(geom, RTC_BUFFER_TYPE_INDEX, 0, RTC_FORMAT_UINT, sizeof(unsigned int), 2*fiber_count);
And i tried vertices_indices = (unsigned int*) rtcSetNewGeometryBuffer(geom, RTC_BUFFER_TYPE_INDEX, 0, RTC_FORMAT_UINT2, sizeof(ISPCHair), fiber_count); but apparently there was a format's error. RTC_FORMAT_UINT2 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have another question about hairs with different geometry types for curve.
Should i pass each curve of hairs as a separate geometry or it's better to put every curve in one geometry ?
In that case of one geometry i would in indices i should put :
vertices_indices[2*i] = offsets;
vertices_indices[2*i+1] = i;
where i is i-th curve and and offets is the position in vertex buffer.
vertices_indices = (unsigned int*) rtcSetNewGeometryBuffer(geom, RTC_BUFFER_TYPE_INDEX, 0, RTC_FORMAT_UINT, sizeof(unsigned int), 2*fiber_count). Is it better to stash each curve in separete geometry?
In case of RTC_GEOMETRY_TYPE_ROUND_BEZIER_CURVE and RTC_GEOMETRY_TYPE_FLAT_BEZIER_CURVE should the number of control vertices should always be 4? Can it vary from one curve to another if we pass all curve in geometry?
Thanks, in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please put many curves inside one geometry to improve memory consumption.
In your rtcSetNewGeometrBuffer example you have to set the stride to 2*sizeof(unsigned int) as you store 2 ints per curve.
In the Bezier basis each curve has 4 control points. However, one can share the ends of the control points between two curves. If that sharing is possible just set the start of the next curve to the end of the previous and add 3 more points.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page