1RTC_GEOMETRY_TYPE_*_CURVE(E3m)bree Ray Tracing KernelsRT3C_GEOMETRY_TYPE_*_CURVE(3)
2
3
4
5 NAME
6 RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE -
7 flat curve geometry with linear basis
8
9 RTC_GEOMETRY_TYPE_FLAT_BEZIER_CURVE -
10 flat curve geometry with cubic Bézier basis
11
12 RTC_GEOMETRY_TYPE_FLAT_BSPLINE_CURVE -
13 flat curve geometry with cubic B-spline basis
14
15 RTC_GEOMETRY_TYPE_FLAT_HERMITE_CURVE -
16 flat curve geometry with cubic Hermite basis
17
18 RTC_GEOMETRY_TYPE_FLAT_CATMULL_ROM_CURVE -
19 flat curve geometry with Catmull-Rom basis
20
21 RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_BEZIER_CURVE -
22 flat normal oriented curve geometry with cubic Bézier basis
23
24 RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_BSPLINE_CURVE -
25 flat normal oriented curve geometry with cubic B-spline basis
26
27 RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_HERMITE_CURVE -
28 flat normal oriented curve geometry with cubic Hermite basis
29
30 RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_CATMULL_ROM_CURVE -
31 flat normal oriented curve geometry with Catmull-Rom basis
32
33 RTC_GEOMETRY_TYPE_ROUND_LINEAR_CURVE -
34 capped cone curve geometry with linear basis and spherical ending
35
36 RTC_GEOMETRY_TYPE_ROUND_BEZIER_CURVE -
37 swept surface curve geometry with cubic Bézier basis
38
39 RTC_GEOMETRY_TYPE_ROUND_BSPLINE_CURVE -
40 swept surface curve geometry with cubic B-spline basis
41
42 RTC_GEOMETRY_TYPE_ROUND_HERMITE_CURVE -
43 swept surface curve geometry with cubic Hermite basis
44
45 RTC_GEOMETRY_TYPE_ROUND_CATMULL_ROM_CURVE -
46 swept surface curve geometry with Catmull-Rom basis
47
48 SYNOPSIS
49 #include <embree3/rtcore.h>
50
51 rtcNewGeometry(device, RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE);
52 rtcNewGeometry(device, RTC_GEOMETRY_TYPE_FLAT_BEZIER_CURVE);
53 rtcNewGeometry(device, RTC_GEOMETRY_TYPE_FLAT_BSPLINE_CURVE);
54 rtcNewGeometry(device, RTC_GEOMETRY_TYPE_FLAT_HERMITE_CURVE);
55 rtcNewGeometry(device, RTC_GEOMETRY_TYPE_FLAT_CATMULL_ROM_CURVE);
56 rtcNewGeometry(device, RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_BEZIER_CURVE);
57 rtcNewGeometry(device, RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_BSPLINE_CURVE);
58 rtcNewGeometry(device, RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_HERMITE_CURVE);
59 rtcNewGeometry(device, RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_CATMULL_ROM_CURVE);
60 rtcNewGeometry(device, RTC_GEOMETRY_TYPE_ROUND_LINEAR_CURVE);
61 rtcNewGeometry(device, RTC_GEOMETRY_TYPE_ROUND_BEZIER_CURVE);
62 rtcNewGeometry(device, RTC_GEOMETRY_TYPE_ROUND_BSPLINE_CURVE);
63 rtcNewGeometry(device, RTC_GEOMETRY_TYPE_ROUND_HERMITE_CURVE);
64 rtcNewGeometry(device, RTC_GEOMETRY_TYPE_ROUND_CATMULL_ROM_CURVE);
65
66 DESCRIPTION
67 Curves with per vertex radii are supported with linear, cubic Bézier,
68 cubic B-spline, and cubic Hermite bases. Such curve geometries are
69 created by passing RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE, RTC_GEOME‐
70 TRY_TYPE_FLAT_BEZIER_CURVE, RTC_GEOMETRY_TYPE_FLAT_BSPLINE_CURVE,
71 RTC_GEOMETRY_TYPE_FLAT_HERMITE_CURVE, RTC_GEOMETRY_TYPE_FLAT_CAT‐
72 MULL_ROM_CURVE, RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_FLAT_BEZIER_CURVE,
73 RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_FLAT_BSPLINE_CURVE, RTC_GEOME‐
74 TRY_TYPE_NORMAL_ORIENTED_FLAT_HERMITE_CURVE, RTC_GEOMETRY_TYPE_NOR‐
75 MAL_ORIENTED_FLAT_CATMULL_ROM_CURVE, RTC_GEOMETRY_TYPE_ROUND_LIN‐
76 EAR_CURVE, RTC_GEOMETRY_TYPE_ROUND_BEZIER_CURVE, RTC_GEOME‐
77 TRY_TYPE_ROUND_BSPLINE_CURVE, RTC_GEOMETRY_TYPE_ROUND_HERMITE_CURVE, or
78 RTC_GEOMETRY_TYPE_ROUND_CATMULL_ROM_CURVE to the rtcNewGeometry func‐
79 tion. The curve indices can be specified through an index buffer
80 (RTC_BUFFER_TYPE_INDEX) and the curve vertices through a vertex buffer
81 (RTC_BUFFER_TYPE_VERTEX). For the Hermite basis a tangent buffer
82 (RTC_BUFFER_TYPE_TANGENT), normal oriented curves a normal buffer
83 (RTC_BUFFER_TYPE_NORMAL), and for normal oriented Hermite curves a nor‐
84 mal derivative buffer (RTC_BUFFER_TYPE_NORMAL_DERIVATIVE) has to get
85 specified additionally. See rtcSetGeometryBuffer and rtcSetSharedGeom‐
86 etryBuffer for more details on how to set buffers.
87
88 The index buffer contains an array of 32-bit indices (RTC_FORMAT_UINT
89 format), each pointing to the first control vertex in the vertex buf‐
90 fer, but also to the first tangent in the tangent buffer, and first
91 normal in the normal buffer if these buffers are present.
92
93 The vertex buffer stores each control vertex in the form of a single
94 precision position and radius stored in (x, y, z, r) order in memory
95 (RTC_FORMAT_FLOAT4 format). The number of vertices is inferred from
96 the size of this buffer. The radii may be smaller than zero but the
97 interpolated radii should always be greater or equal to zero. Similar‐
98 ly, the tangent buffer stores the derivative of each control vertex (x,
99 y, z, r order and RTC_FORMAT_FLOAT4 format) and the normal buffer
100 stores a single precision normal per control vertex (x, y, z order and
101 RTC_FORMAT_FLOAT3 format).
102
103 Linear Basis
104 For the linear basis the indices point to the first of 2 consecutive
105 control points in the vertex buffer. The first control point is the
106 start and the second control point the end of the line segment. When
107 constructing hair strands in this basis, the end-point can be shared
108 with the start of the next line segment.
109
110 For the linear basis the user has to additionally provide a flags buf‐
111 fer of type RTC_BUFFER_TYPE_FLAGS which contains bytes that encode if
112 the left neighbor segment (RTC_CURVE_FLAG_NEIGHBOR_LEFT flag) and/or
113 right neighbor segment (RTC_CURVE_FLAG_NEIGHBOR_RIGHT flags) exist (see
114 [RTCCurveFlags]).
115
116 A left neighbor segment is assumed to end at the start vertex of the
117 current segement, and to start at the previous vertex in the vertex
118 buffer. Similarly, the right neighbor segment is assumed to start at
119 the end vertex of the current segment, and to end at the next vertex in
120 the vertex buffer.
121
122 Only when the left and right bits are properly specified the current
123 segment can properly attach to the left and/or right neighbor, other‐
124 wise the touching area may not get rendererd properly.
125
126 Bézier Basis
127 For the cubic Bézier basis the indices point to the first of 4 consecu‐
128 tive control points in the vertex buffer. These control points use the
129 cubic Bézier basis, where the first control point represents the start
130 point of the curve, and the 4th control point the end point of the
131 curve. The Bézier basis is interpolating, thus the curve does go ex‐
132 actly through the first and fourth control vertex.
133
134 B-spline Basis
135 For the cubic B-spline basis the indices point to the first of 4 con‐
136 secutive control points in the vertex buffer. These control points
137 make up a cardinal cubic B-spline (implicit equidistant knot vector).
138 This basis is not interpolating, thus the curve does in general not go
139 through any of the control points directly. A big advantage of this
140 basis is that 3 control points can be shared for two continuous neigh‐
141 boring curve segments, e.g. the curves (p0,p1,p2,p3) and (p1,p2,p3,p4)
142 are C1 continuous. This feature make this basis a good choise to con‐
143 struct continuous multi-segment curves, as memory consumption can be
144 kept minimal.
145
146 Hermite Basis
147 For the cubic Hermite basis the indices point to the first of 2 consec‐
148 utive points in the vertex buffer, and the first of 2 consecutive tan‐
149 gents in the tangent buffer. These two points and two tangents make up
150 a cubic Hermite curve. This basis is interpolating, thus does exactly
151 go through the first and second control point, and the first order de‐
152 rivative at the begin and end matches exactly the value specified in
153 the tangent buffer. When connecting two segments continuously, the end
154 point and tangent of the previous segment can be shared. Different
155 versions of Catmull-Rom splines can be easily constructed usig the Her‐
156 mite basis, by calculating a proper tangent buffer from the control
157 points.
158
159 Catmull-Rom Basis
160 For the Catmull-Rom basis the indices point to the first of 4 consecu‐
161 tive control points in the vertex buffer. This basis goes through p1
162 and p2, with tangents (p2-p0)/2 and (p3-p1)/2.
163
164 Flat Curves
165 The RTC_GEOMETRY_TYPE_FLAT_* flat mode is a fast mode designed to ren‐
166 der distant hair. In this mode the curve is rendered as a connected
167 sequence of ray facing quads. Individual quads are considered to have
168 subpixel size, and zooming onto the curve might show geometric arti‐
169 facts. The number of quads to subdivide into can be specified through
170 the rtcSetGeometryTessellationRate function. By default the tessella‐
171 tion rate is 4.
172
173 Normal Oriented Curves
174 The RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_* mode is a mode designed to ren‐
175 der blades of grass. In this mode a vertex spline has to get specified
176 as for the previous modes, but additionally a normal spline is re‐
177 quired. If the Hermite basis is used, the RTC_BUFFER_TYPE_NORMAL and
178 RTC_BUFFER_TYPE_NORMAL_DERIVATIVE buffers have both to be set.
179
180 The curve is rendered as a flat band whose center approximately follows
181 the provided vertex spline, whose half width approximately follows the
182 provided radius spline, and whose normal orientation approximately fol‐
183 lows the provided normal spline.
184
185 To intersect the normal oriented curve, we perform a newton-raphson
186 style intersection of a ray with a tensor product surface of a linear
187 basis (perpendicular to the curve) and cubic Bézier basis (along the
188 curve). We use a guide curve and its derivatives to construct the con‐
189 trol points of that surface. The guide curve is defined by a sweep
190 surface defined by sweeping a line centered at the vertex spline loca‐
191 tion along the curve. At each parameter value the half width of the
192 line matches the radius spline, and the direction matches the cross
193 product of the normal from the normal spline and tangent of the vertex
194 spline. Note that this construction does not work when the provided
195 normals are parallel to the curve direction. For this reason the pro‐
196 vided normals should best be kept as perpendicular to the curve direc‐
197 tion as possible.
198
199 Round Curves
200 In the RTC_GEOMETRY_TYPE_ROUND_* round mode, a real geometric surface
201 is rendered for the curve, which is more expensive but allows closeup
202 views.
203
204 For the linear basis the round mode renders an end sphere for a segment
205 and a cone that tangentially touches that ending sphere (and an imagi‐
206 nary start sphere). The geometry clips away parts of the end spheres
207 that lies inside the neighboring segments, thus the curve interiour
208 will also render properly as long as only neighboring segments pene‐
209 trate into a segment. For this to work properly it is important that
210 the flags buffer is properly populated with neighbor information.
211
212 For the cubic polynomial bases, the round mode renders a sweep surface
213 by sweeping a varying radius circle tangential along the curve. As a
214 limitation, the radius of the curve has to be smaller than the curva‐
215 ture radius of the curve at each location on the curve.
216
217 The intersection with the curve segment stores the parametric hit loca‐
218 tion along the curve segment as u-coordinate (range 0 to +1).
219
220 For flat curves, the v-coordinate is set to the normalized distance in
221 the range -1 to +1. For normal oriented curves the v-coordinate is in
222 the range 0 to 1. For the linear basis and in round mode the v-coordi‐
223 nate is set to zero.
224
225 In flat mode, the geometry normal Ng is set to the tangent of the curve
226 at the hit location. In round mode and for normal oriented curves, the
227 geometry normal Ng is set to the non-normalized geometric normal of the
228 surface.
229
230 For multi-segment motion blur, the number of time steps must be first
231 specified using the rtcSetGeometryTimeStepCount call. Then a vertex
232 buffer for each time step can be set using different buffer slots, and
233 all these buffers must have the same stride and size. For the Hermite
234 basis also a tangent buffer has to be set for each time step and for
235 normal oriented curves a normal buffer has to get specified for each
236 time step.
237
238 Also see tutorials [Hair] and [Curves] for examples of how to create
239 and use curve geometries.
240
241 EXIT STATUS
242 On failure NULL is returned and an error code is set that can be
243 queried using rtcGetDeviceError.
244
245 SEE ALSO
246 [rtcNewGeometry, RTCCurveFlags]
247
248
249
250 RTC_GEOMETRY_TYPE_*_CURVE(3)