88 #ifndef TACHYONOPTIXSHADERS_H    89 #define TACHYONOPTIXSHADERS_H    92 #define TACHYON_RAYSTATS 1    96 #if OPTIX_VERSION >= 70300    97 #define TACHYON_OPTIXDENOISER 1   101 #define TACHYON_USE_GEOMFLAGS 1   106 #define RT_DEFAULT_MAX 1e27f   161 #if defined(OPTIX_PRIMITIVE_TYPE_CUSTOM)   162 #define RT_CUSTPRIM    (OPTIX_PRIMITIVE_TYPE_CUSTOM << 16)   163 #define RT_TRI_BUILTIN (OPTIX_PRIMITIVE_TYPE_TRIANGLE << 16)   165 #define RT_CUSTPRIM    0 // OptiX 7.0.0   166 #define RT_TRI_BUILTIN OPTIX_HIT_KIND_TRIANGLE_FRONT_FACE   187                        (0xFE & OPTIX_HIT_KIND_TRIANGLE_FRONT_FACE),
   189 #
if OPTIX_VERSION >= 70400
   190   RT_PRM_CATMULLROM = (OPTIX_PRIMITIVE_TYPE_ROUND_CATMULLROM << 16), 
   192 #if OPTIX_VERSION >= 70200   193   RT_PRM_LINEAR     = (OPTIX_PRIMITIVE_TYPE_ROUND_LINEAR << 16),
   331 #if defined(TACHYON_USE_GEOMFLAGS)   353 struct __align__( OPTIX_SBT_RECORD_ALIGNMENT ) HGRecord {
   354   __align__( OPTIX_SBT_RECORD_ALIGNMENT ) 
char header[OPTIX_SBT_RECORD_HEADER_SIZE];
   371 struct __align__( OPTIX_SBT_RECORD_ALIGNMENT ) ExceptionRecord {
   372   __align__( OPTIX_SBT_RECORD_ALIGNMENT ) 
char header[OPTIX_SBT_RECORD_HEADER_SIZE];
   377 struct __align__( OPTIX_SBT_RECORD_ALIGNMENT ) RaygenRecord {
   378   __align__( OPTIX_SBT_RECORD_ALIGNMENT ) 
char header[OPTIX_SBT_RECORD_HEADER_SIZE];
   383 struct __align__( OPTIX_SBT_RECORD_ALIGNMENT ) MissRecord {
   384   __align__( OPTIX_SBT_RECORD_ALIGNMENT ) 
char header[OPTIX_SBT_RECORD_HEADER_SIZE];
   403 #if defined(TACHYON_OPTIXDENOISER)   405     float4 *denoiser_colorbuffer; 
   406     int denoiser_enabled;         
   412 #if defined(TACHYON_RAYSTATS)   413     uint4 *raystats1_buffer;      
   414     uint4 *raystats2_buffer;      
   479 #define M_PI 3.14159265358979323846   482 #define M_PIf 3.14159265358979323846f   500 inline __host__ __device__ float2 
operator+(
const float2& a, 
const float2& b) {
   501   return make_float2(a.x + b.x, a.y + b.y);
   504 inline __host__ __device__ float2 
operator+(
const float2& a, 
const float s) {
   505   return make_float2(a.x + s, a.y + s);
   508 inline __host__ __device__ float2 
operator-(
const float2& a, 
const float2& b) {
   509   return make_float2(a.x - b.x, a.y - b.y);
   512 inline __host__ __device__ float2 
operator-(
const float2& a, 
const float s) {
   513   return make_float2(a.x - s, a.y - s);
   516 inline __host__ __device__ float2 
operator-(
const float s, 
const float2& a) {
   517   return make_float2(s - a.x, s - a.y);
   520 inline __host__ __device__ float2 
operator*(
const float2& a, 
const float2& b) {
   521   return make_float2(a.x * b.x, a.y * b.y);
   524 inline __host__ __device__ float2 
operator*(
const float s, 
const float2& a) {
   525   return make_float2(a.x * s, a.y * s);
   528 inline __host__ __device__ float2 
operator*(
const float2& a, 
const float s) {
   529   return make_float2(a.x * s, a.y * s);
   532 inline __host__ __device__ 
void operator*=(float2& a, 
const float s) {
   536 inline __host__ __device__ float2 
operator/(
const float s, 
const float2& a) {
   537   return make_float2(s/a.x, s/a.y);
   553 inline __host__ __device__ float3 
operator+(float3 a, float3 b) {
   554   return make_float3(a.x + b.x, a.y + b.y, a.z + b.z);
   557 inline __host__ __device__ float3 
operator-(
const float3& a, 
const float3 &b) {
   561 inline __host__ __device__ float3 
operator-(
const float3& a) {
   565 inline __host__ __device__ 
void operator+=(float3& a, 
const float3& b) {
   566   a.x += b.x; a.y += b.y; a.z += b.z;
   569 inline __host__ __device__ float3 
operator+(
const float3& a, 
const float &b) {
   573 inline __host__ __device__ float3 
operator*(
const float3& a, 
const float3 &b) {
   574   return make_float3(a.x * b.x, a.y * b.y, a.z * b.z);
   577 inline __host__ __device__ float3 
operator*(
float s, 
const float3 &a) {
   581 inline __host__ __device__ float3 
operator*(
const float3 &a, 
const float s) {
   585 inline __host__ __device__ 
void operator*=(float3& a, 
const float s) {
   586   a.x *= s; a.y *= s; a.z *= s;
   589 inline __host__ __device__ 
void operator*=(float3& a, 
const float3 &b) {
   590   a.x *= b.x; a.y *= b.y; a.z *= b.z;
   593 inline __host__ __device__ float3 
operator/(
const float3 &a, 
const float3 &b) {
   594   return make_float3(a.x / b.x, a.y / b.y, a.z / b.z);
   601 inline __host__ __device__ float4 
make_float4(
const float3 &a, 
const float &b) {
   609 inline __host__ __device__ 
void operator+=(float4& a, 
const float4& b) {
   610   a.x += b.x; a.y += b.y; a.z += b.z; a.w += b.w;
   613 inline __host__ __device__ float4 
operator*(
const float4& a, 
const float s) {
   614   return make_float4(a.x * s, a.y * s, a.z * s, a.w * s);
   617 inline __host__ __device__ 
void operator*=(float4& a, 
const float &b) {
   618   a.x *= b; a.y *= b; a.z *= b; a.w *= b;
   625 inline __host__ __device__ float3 
operator*(char4 a, 
const float s) {
   629 inline __host__ __device__ float3 
operator*(uchar4 a, 
const float s) {
   637 inline __host__ __device__ float3 
fabsf(
const float3& a) {
   641 inline __host__ __device__ float3 
fmaxf(
const float3& a, 
const float3& b) {
   645 inline __host__ __device__ 
float fmaxf(
const float3& a) {
   649 inline __host__ __device__ 
float dot(
const float3 & a, 
const float3 & b) {
   650   return a.x*b.x + a.y*b.y + a.z*b.z;
   653 inline __host__ __device__ 
float dot(
const float4 & a, 
const float4 & b) {
   654   return a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w;
   657 inline __host__ __device__ 
float length(
const float3 & v) {
   658   return sqrtf(
dot(v, v));
   663 inline __host__ __device__ float3 
normalize(
const float3 & v) {
   664 #if defined(__CUDACC__) || defined(__NVCC__)   665   float invlen = rsqrtf(
dot(v, v));
   667   float invlen = 1.0f / sqrtf(
dot(v, v));
   670   out.x = v.x * invlen;
   671   out.y = v.y * invlen;
   672   out.z = v.z * invlen;
   680   float invlen = 1.0f / l;
   682   out.x = v.x * invlen;
   683   out.y = v.y * invlen;
   684   out.z = v.z * invlen;
   692 #if defined(__CUDACC__) || defined(__NVCC__)   693   invlen = rsqrtf(
dot(v, v));
   695   invlen = 1.0f / sqrtf(
dot(v, v));
   698   out.x = v.x * invlen;
   699   out.y = v.y * invlen;
   700   out.z = v.z * invlen;
   706 inline __host__ __device__ float3 
cross(
const float3 & a, 
const float3 & b) {
   708   out.x =  a.y * b.z - b.y * a.z;
   709   out.y = -a.x * b.z + b.x * a.z;
   710   out.z =  a.x * b.y - b.x * a.y;
   717 inline __host__ __device__ float3 
reflect(
const float3& i, 
const float3& n) {
   718   return i - 2.0f * n * 
dot(n, i);
   724 inline __host__ __device__ float3 
faceforward(
const float3& n, 
const float3& i,
   725                                               const float3& nref) {
   726   return n * copysignf(1.0f, 
dot(i, nref));
   739 #define UINT32_RAND_MAX     4294967296.0f      // max uint32 random value   740 #define UINT32_RAND_MAX_INV 2.3283064365e-10f  // normalize uint32 RNs   771 static __host__ __device__ __inline__
   797 static __host__ __device__ __inline__
   799   const uint64_t s = 0xb5ad4eceda1ce2a9;
   803   x = (x>>32) | (x<<32); 
   822 #define SQUARES_RNG_KEY1 0x1235d7fcb4dfec21  // a few good keys...   823 #define SQUARES_RNG_KEY2 0x418627e323f457a1  // a few good keys...   824 #define SQUARES_RNG_KEY3 0x83fc79d43614975f  // a few good keys...   825 #define SQUARES_RNG_KEY4 0xc62f73498cb654e3  // a few good keys...   829 template<
unsigned int ROUNDS> 
static __host__ __device__ __inline__
   832   y = x = counter * key;
   836   x = (x>>32) | (x<<32);      
   842     x = (x>>32) | (x<<32);    
   848       x = (x>>32) | (x<<32);  
   875 template<
unsigned int ROUNDS> 
static __host__ __device__ __inline__
   876 unsigned int tea(uint32_t val0, uint32_t val1) {
   881   for (
unsigned int n = 0; n < ROUNDS; n++) {
   883     v0 += ((v1<<4)+0xa341316c)^(v1+s0)^((v1>>5)+0xc8013ea4);
   884     v1 += ((v0<<4)+0xad90777d)^(v0+s0)^((v0>>5)+0x7e95761e);
   907 static __device__ __inline__
   909   const double g = 1.61803398874989484820458683436563;
   910   const double a1 = 1.0 / g;
   911   const double seed = 0.5;
   913   ngold = (seed + (a1 * n));
   914   return ngold - trunc(ngold);
   919 static __device__ __inline__
   921   const double g = 1.61803398874989484820458683436563;
   922   const double a1 = 1.0 / g;
   923   float ngold = x + a1;
   924   x = ngold - truncf(ngold);
   929 static __device__ __inline__
   931   const double g = 1.32471795724474602596;
   932   const double a1 = 1.0 / g;
   933   const double a2 = 1.0 / (g*g);
   934   const double seed = 0.5;
   937   ngold = (seed + (a1 * n));
   938   xy.x = (float) (ngold - trunc(ngold));
   940   ngold = (seed + (a2 * n));
   941   xy.y = (float) (ngold - trunc(ngold));
   946 static __device__ __inline__
   948   const float g = 1.32471795724474602596;
   949   const float a1 = 1.0 / g;
   950   const float a2 = 1.0 / (g*g);
   954   xy.x = (ngold - trunc(ngold));
   957   xy.y = (ngold - trunc(ngold));
   962 static __device__ __inline__
   964   const double g = 1.22074408460575947536;
   965   const double a1 = 1.0 / g;
   966   const double a2 = 1.0 / (g*g);
   967   const double a3 = 1.0 / (g*g*g);
   968   const double seed = 0.5;
   971   ngold = (seed + (a1 * n));
   972   xyz.x = (float) (ngold - trunc(ngold));
   974   ngold = (seed + (a2 * n));
   975   xyz.y = (float) (ngold - trunc(ngold));
   977   ngold = (seed + (a3 * n));
   978   xyz.z = (float) (ngold - trunc(ngold));
   983 static __device__ __inline__
   985   const float g = 1.22074408460575947536;
   986   const float a1 = 1.0 / g;
   987   const float a2 = 1.0 / (g*g);
   988   const float a3 = 1.0 / (g*g*g);
   992   xyz.x = (ngold - trunc(ngold));
   995   xyz.y = (ngold - trunc(ngold));
   998   xyz.z = (ngold - trunc(ngold));
  1003 static __device__ __inline__
  1005   const double g = 1.167303978261418740;
  1006   const double a1 = 1.0 / g;
  1007   const double a2 = 1.0 / (g*g);
  1008   const double a3 = 1.0 / (g*g*g);
  1009   const double a4 = 1.0 / (g*g*g*g);
  1010   const double seed = 0.5;
  1013   ngold = (seed + (a1 * n));
  1014   xy1.x = (float) (ngold - trunc(ngold));
  1016   ngold = (seed + (a2 * n));
  1017   xy1.y = (float) (ngold - trunc(ngold));
  1019   ngold = (seed + (a3 * n));
  1020   xy2.x = (float) (ngold - trunc(ngold));
  1022   ngold = (seed + (a4 * n));
  1023   xy2.y = (float) (ngold - trunc(ngold));
  1028 static __device__ __inline__
  1030   const double g = 1.167303978261418740;
  1031   const float a1 = 1.0 / g;
  1032   const float a2 = 1.0 / (g*g);
  1033   const float a3 = 1.0 / (g*g*g);
  1034   const float a4 = 1.0 / (g*g*g*g);
  1038   xy1.x = (ngold - trunc(ngold));
  1041   xy1.y = (ngold - trunc(ngold));
  1044   xy2.x = (ngold - trunc(ngold));
  1047   xy2.y = (ngold - trunc(ngold));
  1057 static __device__ __inline__
  1065 static __device__ __inline__
  1075   __sincosf(phi, &xy.x, &xy.y); 
  1076   xy *= sqrtf(r) * radius;
  1084   } 
while ((xy.x*xy.x + xy.y*xy.y) > 1.0f);
  1092 static __device__ __inline__
  1094   xy = qrnxy - make_float2(0.5f, 0.5f);
  1100 static __device__ __inline__
  1104   float phi=qrnxy.y * 2.0f * 
M_PIf;
  1105   __sincosf(phi, &xy.x, &xy.y); 
  1106   xy *= sqrtf(r) * radius;
  1114 #if defined(TACHYON_INTERNAL)  1117 static __device__ __inline__
  1129   dir.z = 2.0f * u1 - 1.0f;
  1130   float R = __fsqrt_rn(1.0f - dir.z*dir.z);  
  1132   float phi = 2.0f * 
M_PIf * u2;
  1133   float sinphi, cosphi;
  1134   __sincosf(phi, &sinphi, &cosphi); 
  1144   dir.z = 2.0f * u1 - 1.0f;
  1145   float R = sqrtf(1.0f - dir.z*dir.z);
  1148   float phi = 2.0f * 
M_PIf * u2;
  1149   float sinphi, cosphi;
  1150   sincosf(phi, &sinphi, &cosphi);
  1167   } 
while (len > 0.250f);
  1168   float invlen = rsqrtf(len);
  1184 static __device__ __inline__
  1185 float3 sphericalFibonacci(
float i, 
float totaln) {
  1186   const float PHI = sqrtf(5.0f) * 0.5f + 0.5f;
  1187   float fraction = (i * (PHI - 1.0f)) - floorf(i * (PHI - 1.0f));
  1189   float phi = 2.0f * 
M_PI * fraction;
  1190   float cosTheta = 1.0f - (2.0f * i + 1.0f) * (1.0f / totaln);
  1191   float sinTheta = sqrt(__saturatef(1.0f - cosTheta * cosTheta));
  1193   float cosPhi, sinPhi;
  1194   sincosf(phi, &cosPhi, &sinPhi);
  1195   return make_float3(cosPhi * sinTheta, sinPhi * sinTheta, cosTheta);
  1198 #endif // TACHYON_INTERNAL  1215 template <
int UNORM>
  1216 static __host__ __device__ __inline__ float2 
OctEncode(float3 n) {
  1217   const float invL1Norm = 1.0f / (
fabsf(n.x) + 
fabsf(n.y) + 
fabsf(n.z));
  1220     projected = 1.0f - make_float2(
fabsf(n.y), 
fabsf(n.x)) * invL1Norm;
  1221     projected.x = copysignf(projected.x, n.x);
  1222     projected.y = copysignf(projected.y, n.y);
  1224     projected = make_float2(n.x, n.y) * invL1Norm;
  1229     projected = projected * 0.5f + 0.5f; 
  1247 template <
int UNORM>
  1248 static __host__ __device__ __inline__ float3 
OctDecode(float2 projected) {
  1251     projected *= 2.0f - 1.0f; 
  1255                          1.0f - (
fabsf(projected.x) + 
fabsf(projected.y)));
  1258     n.x = copysignf(1.0f - 
fabsf(n.y), oldX);
  1259     n.y = copysignf(1.0f - 
fabsf(oldX), n.y);
  1270 #if defined(TACHYON_INTERNAL)  1282 template <
int UNORM>
  1283 static __device__ __inline__ float3 OctDecode_fast(float2 projected) {
  1286     projected *= 2.0f - 1.0f; 
  1290                          1.0f - 
fabsf(projected.x) - 
fabsf(projected.y));
  1291   float t = __saturatef(-n.z); 
  1292   n.x += (n.x >= 0.0f) ? -t : t;
  1293   n.y += (n.y >= 0.0f) ? -t : t;
  1298 #endif // TACHYON_INTERNAL  1309   f2 = f2 * 0.5f + 0.5f;
  1311   packed = ((uint) (f2.x * 65535)) | ((uint) (f2.y * 65535) << 16);
  1317   f2.x = (float)((packed      ) & 0x0000ffff) / 65535;
  1318   f2.y = (float)((packed >> 16) & 0x0000ffff) / 65535;
  1319   return f2 * 2.0f - 1.0f;
  1332 static __host__ __device__ __inline__ uint 
packNormal(
const float3& normal) {
  1333   float2 octf2 = OctEncode<0>(normal);
  1339   return OctDecode<0>(octf2);
  1358 static __host__ __device__ __inline__ uint 
packNormal(
const float3& normal) {
  1360   const float3 N = normal * 127.5f - 0.5f;
  1361   const char4 packed = make_char4(N.x, N.y, N.z, 0);
  1362   return *((uint *) &packed);
  1365 static __host__ __device__ __inline__ float3 
unpackNormal(uint packed) {
  1366   char4 c4norm = *((char4 *) &packed);
  1370   const float ci2f = 1.0f / 255.0f;
  1371   const float cn2f = 1.0f / 127.5f;
  1372   float3 N = c4norm * cn2f + ci2f;
  1397 static __forceinline__ __device__
  1400   if (rgba.x <= 0.0404482362771082f) {
  1401     lin.x = rgba.x * 0.0773993f; 
  1403     lin.x = powf(((rgba.x + 0.055f)/1.055f), 2.4f);
  1406   if (rgba.y <= 0.0404482362771082f) {
  1407     lin.y = rgba.y * 0.0773993f; 
  1409     lin.y = powf(((rgba.y + 0.055f)/1.055f), 2.4f);
  1412   if (rgba.z <= 0.0404482362771082f) {
  1413     lin.z = rgba.z * 0.0773993f; 
  1415     lin.z = powf(((rgba.z + 0.055f)/1.055f), 2.4f);
  1427 static __forceinline__ __device__
  1430   if (lin.x > 0.0031308f) {
  1431     rgba.x = 1.055f * (powf(lin.x, (1.0f / 2.4f))) - 0.055f;
  1433     rgba.x = 12.92f * lin.x;
  1436   if (lin.y > 0.0031308f) {
  1437     rgba.y = 1.055f * (powf(lin.y, (1.0f / 2.4f))) - 0.055f;
  1439     rgba.y = 12.92f * lin.y;
  1442   if (lin.z > 0.0031308f) {
  1443     rgba.z = 1.055f * (powf(lin.z, (1.0f / 2.4f))) - 0.055f;
  1445     rgba.z = 12.92f * lin.z;
  1460 static __forceinline__ __device__
  1463   float3 lin = sRGB * (sRGB * (sRGB * 0.305306011f + 0.682171111f) + 0.012522878f);
  1473 static __forceinline__ __device__
  1476   float3 S1 = 
make_float3(sqrtf(lin.x), sqrtf(lin.y), sqrtf(lin.z));
  1477   float3 S2 = 
make_float3(sqrtf(S1.x), sqrtf(S1.y), sqrtf(S1.z));
  1478   float3 S3 = 
make_float3(sqrtf(S2.x), sqrtf(S2.y), sqrtf(S2.z));
  1479   float3 sRGB = 0.662002687f * S1 + 0.684122060f * S2 
  1480                 - 0.323583601f * S3 - 0.0225411470f * lin; 
  1489 static __forceinline__ __device__
  1499 static __forceinline__ __device__
  1502   float3 sRGB = 
make_float3(sqrtf(lin.x), sqrtf(lin.y), sqrtf(lin.z));
  1533 static __device__ __inline__ 
  1542 static __device__ __inline__ 
  1545   return c * (newluminance / l);
  1554 static __device__ __inline__ 
  1556   float3 num = c * (2.51f * c + 
make_float3(0.03f));
  1558   float3 t = num / den;
  1567 static __device__ __inline__ 
  1577 static __device__ __inline__ 
  1588 static __device__ __inline__ 
  1591   float num = oldL * (1.0f + (oldL / (maxL * maxL)));
  1592   float newL = num / (1.0f + oldL);
  1601 #if defined(TACHYON_INTERNAL)  1604 static __device__ __inline__ float3 clamp_float3(
const float3 &a) {
  1605   return make_float3(__saturatef(a.x), __saturatef(a.y), __saturatef(a.z));
  1609 static __device__ __inline__ float4 clamp_float4(
const float4 &a) {
  1610   return make_float4(__saturatef(a.x), __saturatef(a.y), 
  1611                      __saturatef(a.z), __saturatef(a.w));
  1620 static __device__ __inline__ uchar4 make_color_rgb4u(
const float3& c) {
  1621   return make_uchar4(static_cast<unsigned char>(__saturatef(c.x)*255.99f),
  1622                      static_cast<unsigned char>(__saturatef(c.y)*255.99f),
  1623                      static_cast<unsigned char>(__saturatef(c.z)*255.99f),
  1628 static __device__ __inline__ uchar4 make_color_rgb4u(
const float4& c) {
  1629   return make_uchar4(static_cast<unsigned char>(__saturatef(c.x)*255.99f),
  1630                      static_cast<unsigned char>(__saturatef(c.y)*255.99f),
  1631                      static_cast<unsigned char>(__saturatef(c.z)*255.99f),
  1632                      static_cast<unsigned char>(__saturatef(c.w)*255.99f));
  1640 static __inline__ __device__
  1641 float4 tonemap_color(
const float4 & colrgba4f, 
int tonemap_mode, 
  1642                      float tonemap_exposure, 
int colorspace) {
  1643   float alpha = colrgba4f.w; 
  1644   float3 color = 
make_float3(colrgba4f) * tonemap_exposure;
  1646   switch (tonemap_mode) {
  1674 #endif // TACHYON_INTERNAL  1684 #endif // TACHYONOPTIXSHADERS_H static __host__ __device__ __inline__ unsigned int tea(uint32_t val0, uint32_t val1)
 
__host__ __device__ float3 normalize(const float3 &v)
Normalize input vector to unit length. 
 
float3 U
camera orthonormal U (right) axis 
 
static __device__ __inline__ float3 rescale_luminance(float3 c, float newluminance)
 
uchar4 * vertcolors4u
unsigned char color representation 
 
float3 texgen_vaxis
world coordinate texgen V axis 
 
uint4 * packednormals
packed normals: ng [n0 n1 n2] 
 
float outlinewidth
width of outline shading effect 
 
static __device__ __inline__ void goldenratioseq4d(int n, float2 &xy1, float2 &xy2)
 
uchar4 * framebuffer
8-bit unorm RGBA framebuffer 
 
float accum_normalize
precalc 1.0f / subframe_index 
 
void * rt_texture(SceneHandle sc, apitexture *apitex)
Translate a texture definition into the internal format used by Tachyon, and returns an opaque pointe...
 
int matflags
alpha/cutout transparency flags 
 
int headlight_mode
Extra VR camera-located headlight. 
 
static __device__ __inline__ float goldenratioseq1d(int n)
 
static __device__ __inline__ void jitter_offset2f(unsigned int &pval, float2 &xy)
 
float bg_grad_invrange
miss background gradient inverse range 
 
float4 * PosRadius
X,Y,Z,Radius packed for coalescing. 
 
float3 bg_grad_updir
miss background gradient up direction 
 
int update_colorbuffer
accumulation copyout flag 
 
cudaTextureObject_t tex
texture, non-zero if valid 
 
static __device__ __inline__ void jitter_disc2f_qrn(float2 &qrnxy, float2 &xy, float radius)
 
int tonemap_mode
output tone mapping mode 
 
__host__ __device__ float3 normalize_len(const float3 v, float &l)
Normalize input vector to unit length, and return its original length. 
 
float ao_lightscale
2.0f/float(ao_samples) 
 
float dof_aperture_rad
DoF (defocus blur) aperture radius. 
 
__host__ __device__ float2 operator+(const float2 &a, const float2 &b)
 
static __host__ __device__ __inline__ uint32_t msws_rng(uint64_t &x, uint64_t &w)
 
float reflectivity
mirror reflectance coefficient 
 
float shininess
specular highlight size (exponential) 
 
float ao_maxdist
AO maximum occlusion distance. 
 
static __device__ __inline__ void goldenratioseq3d_incr(float3 &xyz)
 
__host__ __device__ float4 make_float4(const float3 &a, const float &b)
 
ring SBT index multiplier 
 
__host__ __device__ float3 make_float3(const float s)
 
float3 * prim_color
optional per-primitive color array 
 
OptiX 7.x built-in curve prims. 
 
float2 * tex2d
2-D texture coordinate buffer 
 
uint4 * packednormals
packed normals: ng [n0 n1 n2] 
 
float3 W
camera orthonormal W (view) axis 
 
__host__ __device__ float3 fmaxf(const float3 &a, const float3 &b)
 
float3 pos
camera position 
 
int max_trans
max transparent surface crossing count 
 
float tonemap_exposure
tone mapping exposure gain parameter 
 
cylinder SBT index multiplier 
 
float3 texgen_uaxis
world coordinate texgen U axis 
 
int userindex
material user index, positive if valid 
 
float ao_direct
AO direct lighting scaling factor. 
 
int materialindex
material index for this array 
 
__host__ __device__ float3 faceforward(const float3 &n, const float3 &i, const float3 &nref)
Ensure that an interpolated surface normal n faces in the same direction as dictated by a geometric n...
 
__host__ __device__ void operator*=(float2 &a, const float s)
 
Tachyon OptiX global launch parameter structure containing the active camera, framebuffer, materials, and any global scene parameters required for shading. 
 
void jitter_sphere3f(rng_frand_handle *rngh, float *dir)
 
int fb_clearall
clear/overwrite all FB components 
 
struct tachyonLaunchParams::@4 lights
 
__host__ __device__ float3 fabsf(const float3 &a)
 
int fog_mode
fog type (or off) 
 
static __forceinline__ __device__ float4 sRGB_to_linear(const float4 &rgba)
 
float3 pos
point light position 
 
cudaTextureObject_t tex
texture, non-zero if valid 
 
__host__ __device__ float3 reflect(const float3 &i, const float3 &n)
calculate reflection direction from incident direction i, and surface normal n. 
 
static __device__ __inline__ void goldenratioseq4d_incr(float2 &xy1, float2 &xy2)
 
float bg_grad_topval
miss background gradient top value 
 
__host__ __device__ float2 operator/(const float s, const float2 &a)
 
float dof_focal_dist
DoF focal plane distance. 
 
struct __align__(OPTIX_SBT_RECORD_ALIGNMENT) HGRecord
SBT record for a hitgroup program. 
 
static __host__ __device__ __inline__ uint packNormal(const float3 &normal)
 
enable cutout/transparency 
 
static __device__ __inline__ void jitter_disc2f(unsigned int &pval, float2 &xy, float radius)
 
static __host__ __device__ __inline__ uint32_t squares_rng(uint64_t counter, uint64_t key)
 
static __device__ __inline__ void goldenratioseq2d_incr(float2 &xy)
 
__host__ __device__ void operator+=(float3 &a, const float3 &b)
 
float outline
outline shading coefficient 
 
static __host__ __device__ __inline__ float2 OctEncode(float3 n)
 
float3 dir
directional light direction 
 
static __host__ __device__ __inline__ float3 unpackNormal(uint packed)
 
float3 texgen_waxis
world coordinate texgen W axis 
 
float fog_end
radial/linear fog end/max distance 
 
int shadows_enabled
global shadow flag 
 
int transmode
transparency behavior 
 
void * rt_directional_light(SceneHandle voidscene, void *tex, apivector dir)
Define a directional light with associated texture and direction. 
 
static __device__ __inline__ void goldenratioseq2d(int n, float2 &xy)
 
int stereo_enabled
stereo rendering on/off 
 
float3 * dir_lights
list of directional light directions 
 
static __device__ __inline__ float3 reinhard_TMO(float3 c)
 
float bg_grad_botval
miss background gradient bottom value 
 
struct tachyonLaunchParams::@3 scene
 
float fog_start
radial/linear fog start distance 
 
float specular
specular reflectance coefficient 
 
enable alpha transparency 
 
__host__ __device__ float dot(const float3 &a, const float3 &b)
 
static __device__ __inline__ float luminance(float3 c)
 
only clamp the color values [0,1] 
 
cudaArray_t d_img
GPU allocated image buffer. 
 
float3 * tex3d
3-D texture coordinate buffer 
 
float3 V
camera orthonormal V (up) axis 
 
"Extended" Reinhard style, color 
 
static __device__ __inline__ float3 ACES_TMO(float3 c)
 
float stereo_convergence_dist
stereo convergence distance (world) 
 
int2 size
framebuffer size 
 
total count of SBT geometric multipliers 
 
float3 bg_color_grad_bot
miss background gradient (bottom) 
 
static __forceinline__ __device__ float4 linear_to_sRGB_approx_20(const float4 &linear)
 
any-hit traversal reversal 
 
static __host__ __device__ __inline__ uint32_t qnd_rng(uint32_t &idum)
 
int dof_enabled
DoF (defocus blur) on/off. 
 
int ao_samples
number of AO samples per AA ray 
 
static __host__ __device__ __inline__ float3 OctDecode(float2 projected)
 
int subframe_index
accumulation subframe index 
 
__host__ __device__ float3 cross(const float3 &a, const float3 &b)
calculate the cross product between vectors a and b. 
 
int userindex
material user index, positive if valid 
 
uchar4 * vertcolors4u
unsigned char color representation 
 
float bg_grad_noisemag
miss background gradient noise magnitude 
 
__host__ __device__ float2 operator-(const float2 &a, const float2 &b)
 
int aa_samples
AA samples per launch. 
 
static __host__ __device__ __inline__ uint convfloat2uint32(float2 f2)
 
cone SBT index multiplier 
 
static __forceinline__ __device__ float4 linear_to_sRGB_approx(const float4 &linear)
 
OptixTraversableHandle traversable
global OptiX scene traversable handle 
 
float3 bg_color_grad_top
miss background gradient (top) 
 
float clipview_end
clipping sphere/plane end coord 
 
quad SBT index multiplier 
 
__host__ __device__ float2 operator*(const float2 &a, const float2 &b)
 
struct tachyonLaunchParams::@2 frame
 
static __device__ __inline__ float3 reinhard_extended_TMO(float3 c, float maxwhite)
 
Store all hitgroup records for a given geometry together for simpler dynamic updates. 
 
__host__ __device__ float length(const float3 &v)
 
float clipview_start
clipping sphere/plane start coord 
 
float opacity
surface opacity 
 
sphere SBT index multiplier 
 
int colorspace
output colorspace 
 
struct tachyonLaunchParams::@5 cam
 
int num_dir_lights
directional light count 
 
float3 * pos_lights
list of positional light positions 
 
#define UINT32_RAND_MAX_INV
 
static __device__ __inline__ void jitter_offset2f_qrn(float2 qrnxy, float2 &xy)
 
int texflags
linear/sRGB colorspace | texturing flags 
 
total count of available colorspaces 
 
custom prim quadrilateral 
 
static __forceinline__ __device__ float4 sRGB_to_linear_approx_20(const float4 &rgba)
 
structure containing Tachyon material properties 
 
rt_material * materials
device memory material array 
 
float diffuse
diffuse reflectance coefficient 
 
static __device__ __inline__ void goldenratioseq3d(int n, float3 &xyz)
 
__host__ __device__ float3 normalize_invlen(const float3 v, float &invlen)
Normalize input vector to unit length, and return the reciprocal of its original length. 
 
float fog_density
exponential fog density 
 
ACES style approximation. 
 
custom prim quadrilateral 
 
float3 bg_color
miss background color 
 
float3 texgen_origin
world coordinate texgen origin 
 
int num_pos_lights
positional light count 
 
static __forceinline__ __device__ float4 sRGB_to_linear_approx(const float4 &rgba)
 
float ambient
constant ambient light factor 
 
static __device__ __inline__ float3 reinhard_extended_luminance_TMO(float3 c, float maxL)
 
static __host__ __device__ __inline__ float2 convuint32float2(uint packed)
 
float ao_ambient
AO ambient factor. 
 
float3 uniform_color
uniform color for entire sphere array 
 
float4 * accum_buffer
32-bit FP RGBA accumulation buffer 
 
static __device__ __inline__ void goldenratioseq1d_incr(float &x)
 
float stereo_eyesep
stereo eye separation, in world coords 
 
int clipview_mode
VR clipping view on/off. 
 
int max_depth
global max ray tracing recursion depth 
 
enable tex cutout transparency 
 
"Extended" Reinhard style, luminance 
 
float epsilon
global epsilon value 
 
static __forceinline__ __device__ float4 linear_to_sRGB(const float4 &lin)
 
float zoom
camera zoom factor