Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

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

Mos__Keicam

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-28-2018
12:44 AM

140 Views

Hairs with Embree

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

6 Replies

SvennW_Intel

Moderator

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-28-2018
10:03 PM

140 Views

Mos__Keicam

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-29-2018
08:45 AM

140 Views

I works !!! It was alignment problem thanks.

SvennW_Intel

Moderator

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-30-2018
01:47 AM

140 Views

Mos__Keicam

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-30-2018
02:12 AM

140 Views

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 ?

Mos__Keicam

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-16-2019
08:22 AM

140 Views

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.

SvennW_Intel

Moderator

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-21-2019
11:44 PM

140 Views

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.

For more complete information about compiler optimizations, see our Optimization Notice.