Support Forum G3D Web Page |
Shader program. More...
Classes | |
struct | Ray |
Public Member Functions | |
mat3 | _referenceFrameFromZAxis (vec3 n) |
BUGGY More... | |
float | computeSampleRate (vec2 texCoord, vec2 samplerSize) |
Computes 2^mipLevel, avoiding the expensive log2 call needed for the actual MIP level. More... | |
float | computeToksvigGlossyExponent (float rawGlossyExponent, float rawNormalLength) |
http://blog.selfshadow.com/2011/07/22/specular-showdown/ More... | |
vec3 | cosPowHemiRandom (vec2 r, const float k) |
Returns cos^k distributed random values distributed on the hemisphere about +z. More... | |
uint | expandBits (uint v) |
Expands a 10-bit integer into 30 bits by inserting 2 zeros after each bit. More... | |
uint | extractEvenBits (uint x) |
vec3 | hammersleyCosHemi (uint i, const uint N) |
Generate the ith 2D Hammersley point out of N on the cosine-weighted unit hemisphere with Z = up. More... | |
vec3 | hammersleyHemi (uint i, const uint N) |
Generate the ith 2D Hammersley point out of N on the cosine-weighted unit hemisphere with Z = up. More... | |
vec2 | hammersleySquare (uint i, const uint N) |
Generate the ith 2D Hammersley point out of N on the unit square [0, 1]^2 More... | |
vec3 | hemisphereRandom (vec2 r) |
vec3 | HSVtoRGB (vec3 c) |
mat4x4 | identity4x4 () |
int | indexOfMaxComponent (vec3 v) |
Returns the index of the largest element. More... | |
int | indexOfMaxComponent (vec2 v) |
Returns the index of the largest element. More... | |
int | indexOfMaxComponent (float v) |
Returns zero. More... | |
float | infIfNegative (float x) |
uint | interleaveBits (uvec3 inputval) |
Calculates a 30-bit Morton code for the given 3D point located within the unit cube [0,1]. More... | |
bool | isFinite (float x) |
gentype | lengthSquared ($(vectype) v) |
float | max3 (float a, float b, float c) |
float | max4 (float a, float b, float c, float d) |
float | maxComponent (vec2 a) |
float | maxComponent (vec3 a) |
float | maxComponent (vec4 a) |
float | mean (float a) |
float | mean (vec2 a) |
float | mean (vec3 a) |
float | mean (vec4 a) |
float | meanComponent (vec4 a) |
float | meanComponent (vec3 a) |
float | meanComponent (vec2 a) |
float | meanComponent (float a) |
float | min3 (float a, float b, float c) |
float | min4 (float a, float b, float c, float d) |
float | minComponent (vec2 a) |
float | minComponent (vec3 a) |
float | minComponent (vec4 a) |
float | mipMapLevel (in vec2 texture_coordinate, in vec2 textureSize) |
Computes the MIP-map level for a texture coordinate. More... | |
float | norm1 (vec3 v) |
float | norm2 (vec3 v) |
float | norm4 (vec2 v) |
L^4 norm. More... | |
float | norm8 (vec2 v) |
L^8 norm. More... | |
float | normInf (vec3 v) |
float | packGlossyExponent (in float blinnPhongExponent) |
mat4x4 | pitch4x4 (float a) |
Constructs a 4x4 Y->Z rotation matrix, assuming R * v multiplication. More... | |
gentype | pow16 ($(gentype) x) |
Compute x^8. More... | |
gentype | pow2 ($(gentype) x) |
gentype | pow3 ($(gentype) x) |
gentype | pow4 ($(gentype) x) |
Compute x^4. More... | |
gentype | pow5 ($(gentype) x) |
Computes x5 More... | |
gentype | pow6 ($(gentype) x) |
Compute x^6. More... | |
gentype | pow64 ($(gentype) v) |
Compute v^64. More... | |
gentype | pow7 ($(gentype) x) |
gentype | pow8 ($(gentype) x) |
Compute x^8. More... | |
mat3 | referenceFrameFromZAxis (vec3 z) |
Given a z-axis, construct an orthonormal tangent space. More... | |
float | RGBtoCIELuminance (vec3 linearRGB) |
CIE luminance (Y) of linearRGB value (not sRGB!) More... | |
vec3 | RGBtoHSV (vec3 c) |
mat4x4 | roll4x4 (float a) |
Constructs a 4x4 X->Y rotation matrix, assuming R * v multiplication. More... | |
vec3 | schlickFresnel (in vec3 F0, in float cos_i, float smoothness) |
Compute Schlick's approximation of the Fresnel coefficient. More... | |
float | signNotZero (in float k) |
vec2 | signNotZero (in vec2 v) |
gentype | smootherstep ($(gentype) edge0, $(gentype) edge1, $(gentype) x) |
Perlin's smootherstep that is analogous to smoothstep() but has zero 1st and 2nd order derivatives at t=0 and t=1, from Texturing and Modeling, Third Edition: A Procedural Approach (see http://en.wikipedia.org/wiki/Smoothstep) More... | |
gentype | smootherstep (float edge0, float edge1, $(gentype) x) |
float | smoothnessToBlinnPhongExponent (in float g3dSmoothness) |
Matches UniversalBSDF::smoothnessToBlinnPhongExponent. More... | |
vec3 | sphereRandom (vec2 r) |
vec3 | sphericalFibonacci (float i, float n) |
Generate a spherical fibonacci point http://lgdv.cs.fau.de/publications/publication/Pub.2015.tech.IMMD.IMMD9.spheri/ To generate a nearly uniform point distribution on the unit sphere of size N, do for (float i = 0.0; i < N; i += 1.0) { float3 point = sphericalFibonacci(i,N); }. More... | |
gentype | square ($(gentype) x) |
float | sum (float a) |
float | sum (vec2 a) |
float | sum (vec3 a) |
float | sum (vec4 a) |
void | swap (inout $(gentype) a, inout $(gentype) b) |
vec4 | textureLodBicubic (sampler2D tex, vec2 uv, int lod) |
Implementation of Sigg and Hadwiger's Fast Third-Order Texture Filtering More... | |
vec4 | textureLodSmooth (sampler2D tex, vec2 uv, int lod) |
A bicubic magnification filter, primarily useful for magnifying LOD 0 without bilinear magnification artifacts. More... | |
mat4x4 | translate4x4 (vec3 t) |
Constructs a 4x4 translation matrix, assuming T * v multiplication. More... | |
gentype | unitSmootherstep ($(gentype) x) |
Avoids the clamping and division for smootherstep(0, 1, x) when x is known to be on the range [0, 1]. More... | |
gentype | unitSmoothstep ($(gentype) x) |
Avoids the clamping and division for smoothstep(0, 1, x) when x is known to be on the range [0, 1]. More... | |
mat4x4 | yaw4x4 (float a) |
Constructs a 4x4 Z->X rotation matrix, assuming R * v multiplication. More... | |
Public Attributes | |
const float | centimeters = 0.01 |
const float | inf |
32-bit floating-point infinity More... | |
const float | inv8Pi = 1.0 / (8.0 * pi) |
const float | invPi = 1.0 / pi |
1 / pi More... | |
const float | meters = 1.0 |
const float | millimeters = 0.001 |
const float | pi = 3.1415927 |
Ratio of unit circle perimeter to its diameter. More... | |
Shader program.
|
inline |
BUGGY
Given a z-axis (n), construct an orthonormal tangent space. Assumes z is a unit vector.
From http://jcgt.org/published/0006/01/01/ listing 3
n | The unit z-axis (3rd column of the output) |
|
inline |
Computes 2^mipLevel, avoiding the expensive log2 call needed for the actual MIP level.
|
inline |
|
inline |
Returns cos^k distributed random values distributed on the hemisphere about +z.
r | Two uniform random numbers on [0,1] See also cosHemiRandom texture. |
Expands a 10-bit integer into 30 bits by inserting 2 zeros after each bit.
Generate the ith 2D Hammersley point out of N on the cosine-weighted unit hemisphere with Z = up.
Generate the ith 2D Hammersley point out of N on the cosine-weighted unit hemisphere with Z = up.
Generate the ith 2D Hammersley point out of N on the unit square [0, 1]^2
|
inline |
r | Two uniform random numbers on [0,1] |
|
inline |
|
inline |
|
inline |
Returns the index of the largest element.
|
inline |
Returns the index of the largest element.
|
inline |
Returns zero.
|
inline |
|
inline |
Calculates a 30-bit Morton code for the given 3D point located within the unit cube [0,1].
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Computes the MIP-map level for a texture coordinate.
|
inline |
|
inline |
|
inline |
L^4 norm.
|
inline |
L^8 norm.
|
inline |
|
inline |
|
inline |
Constructs a 4x4 Y->Z rotation matrix, assuming R * v multiplication.
a is in radians.
|
inline |
Compute x^8.
|
inline |
|
inline |
|
inline |
Compute x^4.
|
inline |
Computes x5
|
inline |
Compute x^6.
|
inline |
Compute v^64.
|
inline |
|
inline |
Compute x^8.
|
inline |
|
inline |
CIE luminance (Y) of linearRGB value (not sRGB!)
|
inline |
|
inline |
Constructs a 4x4 X->Y rotation matrix, assuming R * v multiplication.
a is in radians.
|
inline |
Compute Schlick's approximation of the Fresnel coefficient.
The original goes to 1.0 at glancing angles, which makes objects appear to glow, so we scale it down to 0.9.
We never put a Fresnel term on perfectly diffuse surfaces, so, if F0 is exactly black, then we keep the result black.
|
inline |
|
inline |
|
inline |
Perlin's smootherstep that is analogous to smoothstep() but has zero 1st and 2nd order derivatives at t=0 and t=1, from Texturing and Modeling, Third Edition: A Procedural Approach (see http://en.wikipedia.org/wiki/Smoothstep)
|
inline |
|
inline |
Matches UniversalBSDF::smoothnessToBlinnPhongExponent.
Maps smoothness [0, 1] to Blinn-Phong exponent [0, infinity].
|
inline |
r | Two uniform random numbers on [0,1] |
http://mathworld.wolfram.com/SpherePointPicking.html
See also g3d_sphereRandom texture and sphericalFibonacci()
|
inline |
Generate a spherical fibonacci point http://lgdv.cs.fau.de/publications/publication/Pub.2015.tech.IMMD.IMMD9.spheri/ To generate a nearly uniform point distribution on the unit sphere of size N, do for (float i = 0.0; i < N; i += 1.0) { float3 point = sphericalFibonacci(i,N); }.
The points go from z = +1 down to z = -1 in a spiral. To generate samples on the +z hemisphere, just stop before i > N/2.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Implementation of Sigg and Hadwiger's Fast Third-Order Texture Filtering
http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter20.html
|
inline |
A bicubic magnification filter, primarily useful for magnifying LOD 0 without bilinear magnification artifacts.
This just adjusts the rate at which we move between taps, not the number of taps.
|
inline |
Constructs a 4x4 translation matrix, assuming T * v multiplication.
|
inline |
Avoids the clamping and division for smootherstep(0, 1, x) when x is known to be on the range [0, 1].
|
inline |
Avoids the clamping and division for smoothstep(0, 1, x) when x is known to be on the range [0, 1].
|
inline |
Constructs a 4x4 Z->X rotation matrix, assuming R * v multiplication.
a is in radians.
const float glsl::g3dmath_glsl::centimeters = 0.01 |
const float glsl::g3dmath_glsl::inf |
32-bit floating-point infinity
const float glsl::g3dmath_glsl::inv8Pi = 1.0 / (8.0 * pi) |
const float glsl::g3dmath_glsl::invPi = 1.0 / pi |
1 / pi
const float glsl::g3dmath_glsl::meters = 1.0 |
const float glsl::g3dmath_glsl::millimeters = 0.001 |
const float glsl::g3dmath_glsl::pi = 3.1415927 |
Ratio of unit circle perimeter to its diameter.