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

Hi,

I have a question about RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE mode.

How to define disjoint curves with this mode?

For example if i want to have 2 curves with 2 vertices each i put in vertex buffer :

[v0, v1, v2, v3, v4, v5, ]

and in index buffer :

[0,1, 3,4 ] this should give 2 curves :

[v0, v1, v2,] and [v3, v4, v5]?

(hair implementation) .

Thanks

Link Copied

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

The linear curve uses 2 control points. Thus in your case you would render the two curves (v0,v1) and (v3,v4).

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

Hi,

it seems not consistent with the code which i saw in tutorial motion_blur_geometry_device.cpp :

/* add line geometry */

unsigned int addLines (RTCScene scene, const Vec3fa& pos, unsigned int num_time_steps)

{

RTCGeometry geom = rtcNewGeometry (g_device, RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE);

rtcSetGeometryTimeStepCount(geom,num_time_steps);

Vec3fa* bspline = (Vec3fa*) alignedMalloc(16*sizeof(Vec3fa),16);

for (int i=0; i<16; i++) {

float f = (float)(i)/16.0f;

bspline* = Vec3fa(2.0f*f-1.0f,sin(12.0f*f),cos(12.0f*f));*

}

for (unsigned int t=0; t<num_time_steps; t++)

{

RTCBufferType bufType = RTC_BUFFER_TYPE_VERTEX;

Vec3fa* vertices = (Vec3fa*) rtcSetNewGeometryBuffer(geom,bufType,t,RTC_FORMAT_FLOAT4,sizeof(Vec3fa),16);

AffineSpace3fa rotation = AffineSpace3fa::rotate(Vec3fa(0,0,0),Vec3fa(0,1,0),2.0f*float(pi)*(float)t/(float)(num_time_steps-1));

AffineSpace3fa scale = AffineSpace3fa::scale(Vec3fa(2.0f,1.0f,1.0f));

for (int i=0; i<16; i++)

vertices* = Vec3fa(xfmPoint(rotation*scale,bspline )+pos,0.2f);*

}

int* indices = (int*) rtcSetNewGeometryBuffer(geom,RTC_BUFFER_TYPE_INDEX,0,RTC_FORMAT_UINT,sizeof(int),15);

for (int i=0; i<15; i++) indices* = i;*

alignedFree(bspline);

rtcCommitGeometry(geom);

unsigned int geomID = rtcAttachGeometry(scene,geom);

rtcReleaseGeometry(geom);

return geomID;

}

From

Looks like in index buffer we put index of the segments - (15 segments and 16 vertices). At least this is the way i implemented - are y actually saying that for having two curves [v0, v1, v2,] and [v3, v4, v5] i should put (0, 1, 1, 2, 3, 4, 4, 5) ? It's confusing. Thanks for the insight in advance.

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

Embree draws a line from vertices[index_buffer[curve_id]+0] to vertices[index_buffer[curve_id]+1].

What do you mean with a curve [v0,v1,v2] ?

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

I want to have two separate curves. It's just strange that in this tutorial it's for (int i=0; i<15; i++) indices* = i;*

So i guess that i'd have to put [0,1,1,2,3,4,4,5] to have curves [v0,v1,v2] and [v3,v4,v5].

How rayhit.hit.primID correspond to this curve ? I guess

rayhit.hit.primID = { 0,1,2,3 } 0 - [0,1] , 1 - [1,2], 2 - [3,4], 3-[4,5] ?

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

In the tutorial vertices get shared between neighboring curves.

If you do not want to share vertices you have to fill the index array with [0,2,4] to get cuves p0->p1 (primID=0), p2->p3 (primID=1), and p4->p5 (primID=2).

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