1rtcSetGeometryDisplacementEFmubnrceteioRna(y3)TracinrgtcKSeertnGeelosme4tryDisplacementFunction(3)
2
3
4
5   NAME
6              rtcSetGeometryDisplacementFunction - sets the displacement function
7                for a subdivision geometry
8
9   SYNOPSIS
10              #include <embree4/rtcore.h>
11
12              struct RTCDisplacementFunctionNArguments
13              {
14                void* geometryUserPtr;
15                RTCGeometry geometry;
16                unsigned int primID;
17                unsigned int timeStep;
18                const float* u;
19                const float* v;
20                const float* Ng_x;
21                const float* Ng_y;
22                const float* Ng_z;
23                float* P_x;
24                float* P_y;
25                float* P_z;
26                unsigned int N;
27              };
28
29              typedef void (*RTCDisplacementFunctionN)(
30                 const struct RTCDisplacementFunctionNArguments* args
31              );
32
33              void rtcSetGeometryDisplacementFunction(
34                RTCGeometry geometry,
35                RTCDisplacementFunctionN displacement
36              );
37
38   DESCRIPTION
39       The  rtcSetGeometryDisplacementFunction  function registers a displace‐
40       ment callback function (displacement argument) for the specified subdi‐
41       vision geometry (geometry argument).
42
43       Only  a  single  callback  function can be registered per geometry, and
44       further invocations overwrite the  previously  set  callback  function.
45       Passing NULL as function pointer disables the registered callback func‐
46       tion.
47
48       The registered displacement callback function is  invoked  to  displace
49       points  on  the subdivision geometry during spatial acceleration struc‐
50       ture construction, during the rtcCommitScene call.
51
52       The callback function of type RTCDisplacementFunctionN is invoked  with
53       a  number  of arguments stored inside the RTCDisplacementFunctionNArgu‐
54       ments structure.  The provided user data pointer of the geometry (geom‐
55       etryUserPtr member) can be used to point to the application’s represen‐
56       tation of the subdivision mesh.  A number N of points to  displace  are
57       specified  in a structure of array layout.  For each point to displace,
58       the local patch UV coordinates (u and v arrays), the normalized  geome‐
59       try  normal  (Ng_x, Ng_y, and Ng_z arrays), and the position (P_x, P_y,
60       and P_z arrays) are provided.  The task of the displacement function is
61       to use this information and change the position data.
62
63       The  geometry handle (geometry member) and primitive ID (primID member)
64       of the patch to displace are additionally provided as well as the  time
65       step  timeStep,  which can be important if the displacement is time-de‐
66       pendent and motion blur is used.
67
68       All passed arrays must be aligned to 64 bytes and  properly  padded  to
69       make  wide  vector  processing  inside the displacement function easily
70       possible.
71
72       Also see tutorial [Displacement Geometry] for an example of how to  use
73       the displacement mapping functions.
74
75   EXIT STATUS
76       On  failure  an  error  code is set that can be queried using rtcGetDe‐
77       viceError.
78
79   SEE ALSO
80       [RTC_GEOMETRY_TYPE_SUBDIVISION]
81
82
83
84                                         rtcSetGeometryDisplacementFunction(3)
Impressum