37 #ifndef RixShadingUtils_h 38 #define RixShadingUtils_h 53 #include "RixPredefinedStrings.hpp" 65 #define F_PI (3.14159265f) 66 #define F_TWOPI (6.283185307f) 67 #define F_FOURPI (12.56637061f) 68 #define F_INVPI (0.318309886f) 69 #define F_INVPISQ (0.1013211836f) 70 #define F_INVTWOPI (0.15915494309f) 71 #define F_INVFOURPI (0.0795774715f) 72 #define F_PIDIV2 (1.57079632679f) 73 #define F_PIDIV4 (0.785398163397f) 74 #define F_DEGTORAD (0.017453292520f) 75 #define F_RADTODEG (57.2957795131f) 76 #define F_INVLN2 (1.44269504089f) 77 #define F_INVLN4 (0.72134752f) 78 #define F_LOG2E (1.44269504088896f) 79 #define F_SQRT2 (1.41421356237f) 80 #define F_MAXDIST (1.0e10f) 81 #define F_SQRTMIN (1.0842021721e-19f) 82 #define F_MINDIVISOR (1.0e-6f) 92 static const RtFloat3 k_ZeroF3(0.0f);
94 static const RtFloat2 k_ZeroF2(0.0f);
96 static const float k_ZeroF(0.0f);
97 static const float k_OneF(1.0f);
98 static const float k_Infinity(1e+38f);
99 static const RtMatrix4x4 k_IdentityMatrix(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1);
114 _BitScanForward64( &r, v );
116 #else // Linux, OS X, gcc or clang 117 return __builtin_ctzll( v );
138 template <
typename T>
158 return (x == x) && (x != std::numeric_limits<float>::infinity()) &&
159 (x != -std::numeric_limits<float>::infinity());
161 return std::isfinite(x);
183 return x < y ? x : y;
193 return x < y ? x : y;
203 return x > y ? x : y;
213 return x > y ? x : y;
223 return x < min ? min : (x > max) ? max : x;
233 return x < min ? min : (x > max) ? max : x;
243 return (x - floorf(x));
254 float n = float(
int(x/y));
255 float result = x - n*y;
256 if (result < 0.0f) result += y;
304 float etaSq = eta * eta;
305 float rcos_tSq = 1.0f - etaSq * (1.0f - rcos_i * rcos_i);
306 if (rcos_tSq <= 0.0f)
310 float rcos_t = std::sqrt(rcos_tSq);
311 float rpar = (eta * rcos_t - rcos_i) / (eta * rcos_t + rcos_i);
312 float rper = (eta * rcos_i - rcos_t) / (eta * rcos_i + rcos_t);
313 *Kr = 0.5f * (rpar * rpar + rper * rper);
330 float VdN = Dot(Nn, Vn);
347 *Rn = 2.0f * VdN * Nn - Vn;
349 float etaSq = eta * eta;
350 float rcos_tSq = 1.0f - etaSq * (1.0f - rcos_i * rcos_i);
351 if (rcos_tSq <= 0.0f)
359 float rcos_t = std::sqrt(rcos_tSq);
360 float rpar = (eta * rcos_t - rcos_i) / (eta * rcos_t + rcos_i);
361 float rper = (eta * rcos_i - rcos_t) / (eta * rcos_i + rcos_t);
362 *Kr = 0.5f * (rpar * rpar + rper * rper);
364 *Tn = sign * (eta * rcos_i - rcos_t) * Nn - eta * Vn;
388 for (
int i = 0; i < nPts; ++i)
391 Kt[i] = 1.0f - Kr[i];
396 for (
int i = 0; i < nPts; ++i)
399 Kt[i] = 1.0f - Kr[i];
421 kappa = 1.0f / kappa;
422 float cosSq = VdN * VdN;
423 float cos2eta = 2.0f * eta * VdN;
424 float t0 = eta * eta + kappa * kappa;
425 float t1 = t0 * cosSq;
426 float rperp = (t0 - cos2eta + cosSq) / (t0 + cos2eta + cosSq);
427 float rpar = (t1 - cos2eta + 1.0f) / (t1 + cos2eta + 1.0f);
428 *Kr = 0.5f * (rpar + rperp);
449 float cosSq = VdN * VdN, sinSq = 1.0f - cosSq, sin4 = sinSq * sinSq;
451 float t0 = eta * eta - kappa * kappa - sinSq;
452 float aSqPlusbSq = std::sqrt(t0 * t0 + 4.0f * kappa * kappa * eta * eta);
453 float a = std::sqrt(0.5f * (aSqPlusbSq + t0));
455 float t1 = aSqPlusbSq + cosSq;
456 float t2 = 2.0f * a * VdN;
458 float rperpSq = (t1 - t2) / (t1 + t2);
460 float t3 = aSqPlusbSq * cosSq + sin4;
461 float t4 = t2 * sinSq;
463 float rparSq = rperpSq * (t3 - t4) / (t3 + t4);
465 *Kr = 0.5f * (rperpSq + rparSq);
489 float VdN = Dot(Nn, Vn);
492 *Rn = 2.0f * VdN * Nn - Vn;
509 if (eta.g == eta.r && kappa.g == kappa.r)
513 if (eta.b == eta.r && kappa.b == kappa.r)
515 else if (eta.b == eta.g && kappa.b == kappa.g)
538 float VdN = Dot(Nn, Vn);
541 *Rn = 2.0f * VdN * Nn - Vn;
560 float f = 1.0f - NdV;
573 float VdN = Dot(Nn, Vn);
574 return 2.0f * VdN * Nn - Vn;
585 return 2.0f * VdN * Nn - Vn;
599 float VdN = Dot(Vn, Nn);
613 float etaSq = eta * eta;
614 float rcos_tSq = 1.0f - etaSq * (1.0f - rcos_i * rcos_i);
615 if (rcos_tSq <= 0.0f)
622 float rcos_t = std::sqrt(rcos_tSq);
623 Tn = sign * (eta * rcos_i - rcos_t) * Nn - eta * Vn;
634 float* VdotNf = NULL)
637 float d = Dot(Vn, Nn);
658 float* VdotNb = NULL)
661 float d = Dot(Vn, Nn);
678 #define ALMOSTZERO 0.005f 699 assert(n.IsUnitLength());
700 assert(t0.IsUnitLength());
701 assert(t1.IsUnitLength());
707 float z = std::sqrt(xi.
y);
708 float r = std::sqrt(std::max(0.0f, 1.0f - xi.
y));
709 float x = r * cosf(e1);
710 float y = r * sinf(e1);
714 outDir = x * t0 + y * t1 + z * n;
717 assert(outDir.IsUnitLength());
734 n.CreateOrthonormalBasis(t0, t1);
757 float r = std::sqrt(std::max(0.0f, 1.0f - z * z));
758 float x = r * cosf(e1);
759 float y = r * sinf(e1);
763 outDir = x * t0 + y * t1 + z * n;
781 n.CreateOrthonormalBasis(t0, t1);
800 float cosAngle = cosf(coneAngle);
801 float z = xi.
y * (1.0f - cosAngle) + cosAngle;
802 float r = std::sqrt(std::max(0.0f, 1.0f - z * z));
803 float x = r * cosf(e1);
804 float y = r * sinf(e1);
808 outDir = x * t0 + y * t1 + z * n;
821 const RtFloat2& xi,
const float coneAngle,
827 n.CreateOrthonormalBasis(t0, t1);
840 outDir.z = 2.0f * xi.
y - 1.0f;
841 float sinTheta = 1.0f - outDir.z * outDir.z;
845 sinTheta = std::sqrt(sinTheta);
847 outDir.x = sinTheta * cosf(phi);
848 outDir.y = sinTheta * sinf(phi);
870 if (xi < thresholds[0])
876 for (
int i = 1; i < numThresholds; i++)
878 if (thresholds[i - 1] <= xi && xi < thresholds[i])
880 xi = (xi - thresholds[i - 1]) / (thresholds[i] - thresholds[i - 1]);
885 float lastThres = thresholds[numThresholds - 1];
886 xi = (xi - lastThres) / (1.0f - lastThres);
887 return numThresholds;
902 return (N.Dot(dir) < 0.0f) ? biasT : biasR;
917 float biasAmt =
RixTraceBias(org, N, dir, biasR, biasT);
923 return org + biasAmt * dir;
935 sincosf(phi, sinPhi, cosPhi);
936 #elif (defined(OSX) && defined(__clang__)) 937 __sincosf(phi, sinPhi, cosPhi);
955 return RtVector3(sinTheta * cosPhi, sinTheta * sinPhi, cosTheta);
965 float sinPhi, cosPhi;
984 result.x = in.x * X.x + in.y * Y.x + in.z * Z.x;
985 result.y = in.x * X.y + in.y * Y.y + in.z * Z.y;
986 result.z = in.x * X.z + in.y * Y.z + in.z * Z.z;
1014 return RtVector3(Dot(in, X), Dot(in, Y), Dot(in, Z));
1021 template <
typename T>
1025 return (1.0f - m) * v0 + m * v1;
1033 template <
typename T>
1045 x3 = x1 + dx * t * t * (3.0f - 2.0f * t);
1056 template <
typename T>
1068 x3 = x1 + dx * t * t;
1079 template <
typename T>
1091 x3 = t * dx * (2.0f - t) + x1;
1108 return val < min ? 0.0f : 1.0f;
1123 : (val >= max ? 1.0f : (val - min) / (max - min));
1130 : (val >= min ? 1.0f : (val - max) / (min - max)));
1151 val = (val - min) / (max - min);
1159 val = 1.0f - (val - max) / (min - max);
1164 return val * val * (3.0f - 2.0f * val);
1182 val = 1.0f - (val - min) / (max - min);
1190 val = (val - max) / (min - max);
1195 return std::pow(2.0f, -8.0f * val * val);
1221 if (solidangle > 1.840302f)
1225 float omega_div_2pi = solidangle * 0.15915494f;
1228 float cosTheta = 1.0f - omega_div_2pi;
1229 assert(cosTheta > 0.0f);
1232 return std::sqrt(1.0f - cosTheta * cosTheta) / cosTheta;
1246 #define RixAlloca(s) alloca(s) 1265 assert(Nf.IsUnitLength());
1266 assert(Tn.IsUnitLength());
1268 if (Nf.AbsDot(Tn) < 0.995f)
1279 Nf.CreateOrthonormalBasis(TX, TY);
1299 float orthonormalCheck = z.Dot(Cross(x, y));
1300 if (orthonormalCheck < 0.98f)
1327 int numPts = sCtx->
numPts;
1330 for (
int i = 0; i < numPts; i++)
1332 newu[i] = u[i] + du[i];
1350 int numPts = sCtx->
numPts;
1353 for (
int i = 0; i < numPts; i++)
1355 newv[i] = v[i] + dv[i];
1375 int numPts = sCtx->
numPts;
1397 for (
int i = 0; i < numPts; i++)
1400 if(disp[i] == 0.0f && dispU[i] == 0.0f && dispV[i] == 0.0f)
1411 RtPoint3 P1 = du[i] * dPdu[i] + Norig[i] * dispU[i];
1412 RtPoint3 P2 = dv[i] * dPdv[i] + Norig[i] * dispV[i];
1413 Nn[i] = Cross(P1 - P0, P2 - P0);
1418 RtNormal3 computedNgn = Cross(du[i] * dPdu[i], dv[i] * dPdv[i]);
1419 computedNgn.Normalize();
1421 float const dotNg = Dot(computedNgn, Ngn[i]);
1438 Nuser_i.Normalize();
1460 computedNgn = -computedNgn;
1463 RtNormal3 const delta = Norig[i] - computedNgn;
1488 static const RtUString k_matteName(
"Ri:Matte");
1489 static const int k_matteLen =
sizeof(float);
1490 static const int k_matteDef = 0;
1492 int matte = k_matteDef;
1502 matteRet = state->GetAttribute(
1503 k_matteName, &matteVal, k_matteLen, &matteType, &matteCount);
1507 else if (matteCount == 1)
1508 matte = (int)matteVal;
1522 static const RtUString k_holdoutName(
"trace:holdout");
1523 static const int k_holdoutLen =
sizeof(float);
1524 static const int k_holdoutDef = 0;
1525 int holdout = k_holdoutDef;
1532 int holdoutRet = state->GetAttribute(
1533 k_holdoutName, &holdoutVal, k_holdoutLen, &holdoutType, &holdoutCount);
1537 holdout = (int)holdoutVal;
1544 RixImod(
const unsigned long a,
const unsigned long b)
1546 unsigned long n = a/b;
1562 RixHash(
const char *bufPtr,
unsigned long range=65535)
1564 unsigned long hash = 5381;
1566 while ((c =
int(*bufPtr++)))
1567 hash = ((hash << 5) + hash) ^ c;
1569 return float(
RixImod(hash,range));
1581 result.r = a.r < b.r ?
RixClamp(result.r, a.r, b.r) :
RixClamp(result.r, b.r, a.r);
1582 result.g = a.g < b.g ?
RixClamp(result.g, a.g, b.g) :
RixClamp(result.g, b.g, a.g);
1583 result.b = a.b < b.b ?
RixClamp(result.b, a.b, b.b) :
RixClamp(result.b, b.b, a.b);
1599 if (Dot(Vn, Ngn) >= 0.0f)
1601 float VdotN = Dot(Vn, Nn);
1606 Nn -= amount * 1.01f * VdotN * Vn;
1618 float cos_d =
RixMin(std::abs(shadingNormal.Dot(bumpNormal)), 1.0f);
1619 float tan2_d = (1.0f - cos_d * cos_d) / (cos_d * cos_d);
1620 float alpha2 =
RixClamp(0.125f * tan2_d , 0.0f , 1.0f);
1622 float cos_i =
RixMax(std::abs(shadingNormal.Dot(Ln)), 1e-6f);
1623 float tan2_i_square = (cos_i * cos_i);
1624 float tan2_i = (1.0f - cos_i * cos_i) / tan2_i_square;
1625 if (tan2_i_square < 1e-6f)
1631 return (2.0f / (1.0f + sqrtf(1.0f + alpha2 * tan2_i)));
1640 float instanceId = 0;
1653 float incidentRayRadius,
float incidentRaySpread)
1655 float sinTheta = std::max(fabsf(incidentRaySpread), fabsf(incidentRayRadius*curvature));
1656 sinTheta *= multiplier;
1658 if (sinTheta == 0.0f)
return 0.0f;
1660 sinTheta = std::min(1.0f, sinTheta);
1661 float cosTheta = sqrtf(std::max(0.0f, 1.0f-sinTheta*sinTheta));
1664 float theta = (sinTheta < 0.01f) ? sinTheta : asinf(sinTheta);
1666 float sigmaSq = (theta*theta-2.0f) + 2.0f*cosTheta*(theta/sinTheta);
1669 return std::max(0.0f, 2.0f*sigmaSq);
1684 return sqrtf(roughness*roughness + rayCurvatureRoughnessSq);
1688 #endif // RixShadingUtils_h Surface V parameterization (type float)
Definition: RixShading.h:959
PRMAN_INLINE float RixRadiansToDegrees(float rads)
Definition: RixShadingUtils.h:132
PRMAN_INLINE int RixIsMatte(RixShadingContext const &sCtx)
Definition: RixShadingUtils.h:1486
PRMAN_INLINE float RixBoxStep(float min, float val)
Definition: RixShadingUtils.h:1106
RixShadingContext is analogous to a RenderMan grid - it is a group of 1 or more points that may be sh...
Definition: RixShading.h:663
PRMAN_INLINE int RixIsHoldout(RixShadingContext const &sCtx)
Definition: RixShadingUtils.h:1520
PRMAN_INLINE void RixAdjustNormal(float const amount, RtVector3 const &Vn, RtVector3 const &Ngn, RtNormal3 &Nn)
Definition: RixShadingUtils.h:1593
PRMAN_INLINE void RixFresnelConductor(float VdN, float eta, float kappa, float *Kr)
Definition: RixShadingUtils.h:445
float x
Definition: RiTypesHelper.h:86
T * AllocForPattern(int num)
Definition: RixShading.h:1395
PRMAN_INLINE float RixGaussStep(float min, float max, float val)
Definition: RixShadingUtils.h:1174
Id for geometric debugger interface.
Definition: RixInterfaces.h:112
virtual void SetBuiltinVar(BuiltinVar, float *var)=0
SetBuiltinVar() allows the values of any builtin variable to be overridden.
Definition: RixInterfaces.h:962
PRMAN_INLINE RtFloat RixProcPrimInstanceHash(RixRenderState *rstate)
Definition: RixShadingUtils.h:1638
PRMAN_INLINE unsigned int RixFindFirstSetBit(unsigned long long v)
Definition: RixShadingUtils.h:110
PRMAN_INLINE void RixUniformConeDistribution(const RtFloat2 &xi, const float coneAngle, const RtVector3 &n, const RtVector3 &t0, const RtVector3 &t1, RtVector3 &outDir, float &cosTheta)
Definition: RixShadingUtils.h:794
PRMAN_INLINE float RixLinearStep(float min, float max, float val)
Definition: RixShadingUtils.h:1117
pxrcore::ColorRGB RtColorRGB
Definition: RiTypesHelper.h:520
PRMAN_INLINE void RixShiftCtxInU(RixShadingContext *sCtx)
Definition: RixShadingUtils.h:1320
PRMAN_INLINE RtColorRGB RixLerpRGB(RtColorRGB const &a, RtColorRGB const &b, float const mix)
Definition: RixShadingUtils.h:1578
PRMAN_INLINE int RixChooseAndRemap(float &xi, int numThresholds, float *thresholds)
Definition: RixShadingUtils.h:867
RtFloat3 RtPoint3
Definition: RiTypesHelper.h:70
virtual int GetAttribute(RtUString const name, void *result, int resultLength, Type *resultType, int *resultCount)=0
#define F_RADTODEG
Definition: RixShadingUtils.h:75
PRMAN_INLINE RtPoint3 RixApplyTraceBias(const RtPoint3 &org, const RtNormal3 &N, const RtVector3 &dir, const float biasR, const float biasT)
Definition: RixShadingUtils.h:910
float RtFloat
Definition: ri.h:54
PRMAN_INLINE T RixEaseInMix(const T &x1, const T &x2, float t)
Definition: RixShadingUtils.h:1058
RixSCDetail
RixSCDetail enumerates the valid sizing qualifiers for SC parameters.
Definition: RixShading.h:432
Definition: RixIntegrator.h:608
Ray footprint (radius) in V (type float)
Definition: RixShading.h:963
PRMAN_INLINE float RixHash(const char *bufPtr, unsigned long range=65535)
Definition: RixShadingUtils.h:1562
Surface derivative in U (type RtFloat3)
Definition: RixShading.h:967
PRMAN_INLINE RtVector3 RixChangeBasisFrom(RtVector3 const &in, RtVector3 const &X, RtVector3 const &Y, RtVector3 const &Z)
Definition: RixShadingUtils.h:977
virtual void GetBuiltinVar(BuiltinVar, int const **var) const =0
virtual void EmitPointNormal(RtPoint3 p, RtNormal3 n, RtColorRGB c)=0
#define F_TWOPI
Definition: RixShadingUtils.h:66
Definition: RiTypesHelper.h:82
Ray footprint (radius) in U (type float)
Definition: RixShading.h:961
Normalized shading normal (type RtFloat3)
Definition: RixShading.h:944
Definition: RixShading.h:434
PRMAN_INLINE T RixEaseOutMix(const T &x1, const T &x2, float t)
Definition: RixShadingUtils.h:1081
PRMAN_INLINE RtNormal3 RixGetForwardFacingNormal(RtVector3 const &Vn, RtNormal3 const &Nn, float *VdotNf=NULL)
Definition: RixShadingUtils.h:631
pxrcore::Float3 RtFloat3
Definition: RiTypesHelper.h:69
Surface U parameterization (type float)
Definition: RixShading.h:958
PRMAN_INLINE void RixComputeShadingBasis(RtNormal3 const &Nf, RtVector3 const &Tn, RtVector3 &TX, RtVector3 &TY)
Definition: RixShadingUtils.h:1255
PRMAN_INLINE int RixRefract(const RtVector3 &Vn, const RtNormal3 &Nn, float eta, RtVector3 &Tn)
Definition: RixShadingUtils.h:596
int numPts
numPts is the number of shading points.
Definition: RixShading.h:696
PRMAN_INLINE unsigned long RixImod(const unsigned long a, const unsigned long b)
Definition: RixShadingUtils.h:1544
PRMAN_INLINE float RixMollifyRoughness(float roughness, float rayCurvatureRoughnessSq)
Definition: RixShadingUtils.h:1682
PRMAN_INLINE float RixDegreesToRadians(float degrees)
Definition: RixShadingUtils.h:124
PRMAN_INLINE RtVector3 RixChangeBasis(RtVector3 const &in, RtVector3 const &X, RtVector3 const &Y, RtVector3 const &Z)
Definition: RixShadingUtils.h:992
PRMAN_INLINE float RixMod(float x, float y)
Definition: RixShadingUtils.h:252
PRMAN_INLINE float RixMax(float x, float y)
Definition: RixShadingUtils.h:201
PRMAN_INLINE RtNormal3 RixGetBackwardFacingNormal(RtVector3 const &Vn, RtNormal3 const &Nn, float *VdotNb=NULL)
Definition: RixShadingUtils.h:655
PRMAN_INLINE float RixSmoothStep(float min, float max, float val)
Definition: RixShadingUtils.h:1143
PRMAN_INLINE void RixUniformDirectionalDistribution(const RtFloat2 &xi, const RtVector3 &n, const RtVector3 &t0, const RtVector3 &t1, RtVector3 &outDir, float &cosTheta)
Definition: RixShadingUtils.h:747
PRMAN_INLINE RtVector3 RixChangeBasisTo(RtVector3 const &in, RtVector3 const &X, RtVector3 const &Y, RtVector3 const &Z)
Definition: RixShadingUtils.h:1008
virtual RixInterface * GetRixInterface(RixInterfaceId id) const =0
Get the specified interface from this context.
PRMAN_INLINE float RixTraceBias(const RtPoint3 &, const RtNormal3 &N, const RtVector3 &dir, float biasR, float biasT)
Definition: RixShadingUtils.h:895
RtFloat3 RtNormal3
Definition: RiTypesHelper.h:73
#define PRMAN_INLINE
Definition: prmanapi.h:99
PRMAN_INLINE T RixMix(const T &v0, const T &v1, float m)
Definition: RixShadingUtils.h:1023
#define F_DEGTORAD
Definition: RixShadingUtils.h:74
PRMAN_INLINE void RixDebugBasis(RixShadingContext *sc, RtPoint3 &o, RtVector3 &x, RtVector3 &y, RtVector3 &z)
Definition: RixShadingUtils.h:1285
PRMAN_INLINE RtVector3 RixSphericalDirection(float sinTheta, float cosTheta, float sinPhi, float cosPhi)
Definition: RixShadingUtils.h:949
PRMAN_INLINE int RixIsFinite(float x)
Definition: RixShadingUtils.h:155
PRMAN_INLINE float RixSolidAngle2Spread(float solidangle)
Definition: RixShadingUtils.h:1203
PRMAN_INLINE T RixSmoothMix(const T &x1, const T &x2, float t)
Definition: RixShadingUtils.h:1035
An interface for discovering the current state of the renderer.
Definition: RixInterfaces.h:777
Id for RixRenderState interface.
Definition: RixInterfaces.h:109
Allocator is a utility (fully inlined) class to assist with tedious memory pool allocations.
Definition: RixShading.h:1363
float y
Definition: RiTypesHelper.h:86
Normalized geometric normal (type RtFloat3)
Definition: RixShading.h:945
PRMAN_INLINE void RixCosDirectionalDistribution(const RtFloat2 &xi, const RtVector3 &n, const RtVector3 &t0, const RtVector3 &t1, RtVector3 &outDir, float &cosTheta)
Definition: RixShadingUtils.h:687
pxrcore::Matrix4x4 RtMatrix4x4
Definition: RiTypesHelper.h:74
virtual RixSCDetail GetPrimVar(const RtUString name, RixSCType *type, int *arraylen) const =0
GetPrimVar: lazily evaluates the named primitive variable.
Surface derivative in V (type RtFloat3)
Definition: RixShading.h:968
PRMAN_INLINE void RixFresnelConductorApprox(float VdN, float eta, float kappa, float *Kr)
Definition: RixShadingUtils.h:413
pxrcore::UString RtUString
Definition: RiTypesHelper.h:682
PRMAN_INLINE RtVector3 RixReflect(const RtVector3 &Vn, const RtNormal3 &Nn)
Definition: RixShadingUtils.h:571
PRMAN_INLINE float RixRayCurvatureToRoughnessSq(float multiplier, float curvature, float incidentRayRadius, float incidentRaySpread)
Definition: RixShadingUtils.h:1652
PRMAN_INLINE T RixSignum(T x)
Definition: RixShadingUtils.h:140
PRMAN_INLINE RtFloat RixBumpShadowingFactor(RtNormal3 shadingNormal, RtNormal3 bumpNormal, RtVector3 Ln)
Definition: RixShadingUtils.h:1613
PRMAN_INLINE RtVector3 RixSphericalDistribution(const RtFloat2 &xi)
Definition: RixShadingUtils.h:837
PRMAN_INLINE void RixSinCos(float phi, float *sinPhi, float *cosPhi)
Definition: RixShadingUtils.h:932
PRMAN_INLINE float RixMin(float x, float y)
Definition: RixShadingUtils.h:181
#define ALMOSTZERO
Definition: RixShadingUtils.h:678
PRMAN_INLINE float RixFractional(float x)
Definition: RixShadingUtils.h:241
PRMAN_INLINE float RixSchlickFresnelWeight(float NdV)
Definition: RixShadingUtils.h:552
Type
Definition: RixInterfaces.h:140
PRMAN_INLINE void RixShiftCtxInV(RixShadingContext *sCtx)
Definition: RixShadingUtils.h:1343
RtFloat3 RtVector3
Definition: RiTypesHelper.h:72
Normalized view vector, points away from shading points (type RtFloat3)
Definition: RixShading.h:948
Normalized analytical undisplaced N (type RtFloat3)
Definition: RixShading.h:984
PRMAN_INLINE void RixBump(RixShadingContext const *sCtx, float const *disp, float const *dispU, float const *dispV, RtNormal3 *Nn)
Definition: RixShadingUtils.h:1368
#define PIXAR_ARGUSED(x)
Definition: prmanapi.h:170
PRMAN_INLINE void RixFresnelDielectric(float VdN, float eta, float *Kr)
Definition: RixShadingUtils.h:296
PRMAN_INLINE float RixClamp(float x, float min, float max)
Definition: RixShadingUtils.h:221