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