Replace tabs by 4 spaces
This commit is contained in:
parent
f3ce3a6f74
commit
65b299c6cf
20 changed files with 309 additions and 309 deletions
|
@ -41,27 +41,27 @@ float RadicalInverseVdC(uint bits)
|
|||
// Compute Hammersley coordinates
|
||||
vec2 Hammersley(uint i, uint N)
|
||||
{
|
||||
return vec2(float(i)/float(N), RadicalInverseVdC(i));
|
||||
return vec2(float(i)/float(N), RadicalInverseVdC(i));
|
||||
}
|
||||
|
||||
// Integrate number of importance samples for (roughness and NoV)
|
||||
vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness)
|
||||
{
|
||||
float a = roughness*roughness;
|
||||
float phi = 2.0 * PI * Xi.x;
|
||||
float cosTheta = sqrt((1.0 - Xi.y)/(1.0 + (a*a - 1.0)*Xi.y));
|
||||
float sinTheta = sqrt(1.0 - cosTheta*cosTheta);
|
||||
float a = roughness*roughness;
|
||||
float phi = 2.0 * PI * Xi.x;
|
||||
float cosTheta = sqrt((1.0 - Xi.y)/(1.0 + (a*a - 1.0)*Xi.y));
|
||||
float sinTheta = sqrt(1.0 - cosTheta*cosTheta);
|
||||
|
||||
// Transform from spherical coordinates to cartesian coordinates (halfway vector)
|
||||
vec3 H = vec3(cos(phi)*sinTheta, sin(phi)*sinTheta, cosTheta);
|
||||
// Transform from spherical coordinates to cartesian coordinates (halfway vector)
|
||||
vec3 H = vec3(cos(phi)*sinTheta, sin(phi)*sinTheta, cosTheta);
|
||||
|
||||
// Transform from tangent space H vector to world space sample vector
|
||||
vec3 up = ((abs(N.z) < 0.999) ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0));
|
||||
vec3 tangent = normalize(cross(up, N));
|
||||
vec3 bitangent = cross(N, tangent);
|
||||
vec3 sampleVec = tangent*H.x + bitangent*H.y + N*H.z;
|
||||
// Transform from tangent space H vector to world space sample vector
|
||||
vec3 up = ((abs(N.z) < 0.999) ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0));
|
||||
vec3 tangent = normalize(cross(up, N));
|
||||
vec3 bitangent = cross(N, tangent);
|
||||
vec3 sampleVec = tangent*H.x + bitangent*H.y + N*H.z;
|
||||
|
||||
return normalize(sampleVec);
|
||||
return normalize(sampleVec);
|
||||
}
|
||||
|
||||
float GeometrySchlickGGX(float NdotV, float roughness)
|
||||
|
|
|
@ -54,26 +54,26 @@ float RadicalInverse_VdC(uint bits)
|
|||
|
||||
vec2 Hammersley(uint i, uint N)
|
||||
{
|
||||
return vec2(float(i)/float(N), RadicalInverse_VdC(i));
|
||||
return vec2(float(i)/float(N), RadicalInverse_VdC(i));
|
||||
}
|
||||
|
||||
vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness)
|
||||
{
|
||||
float a = roughness*roughness;
|
||||
float phi = 2.0*PI*Xi.x;
|
||||
float cosTheta = sqrt((1.0 - Xi.y)/(1.0 + (a*a - 1.0)*Xi.y));
|
||||
float sinTheta = sqrt(1.0 - cosTheta*cosTheta);
|
||||
float a = roughness*roughness;
|
||||
float phi = 2.0*PI*Xi.x;
|
||||
float cosTheta = sqrt((1.0 - Xi.y)/(1.0 + (a*a - 1.0)*Xi.y));
|
||||
float sinTheta = sqrt(1.0 - cosTheta*cosTheta);
|
||||
|
||||
// Transform from spherical coordinates to cartesian coordinates (halfway vector)
|
||||
vec3 H = vec3(cos(phi)*sinTheta, sin(phi)*sinTheta, cosTheta);
|
||||
// Transform from spherical coordinates to cartesian coordinates (halfway vector)
|
||||
vec3 H = vec3(cos(phi)*sinTheta, sin(phi)*sinTheta, cosTheta);
|
||||
|
||||
// Transform from tangent space H vector to world space sample vector
|
||||
vec3 up = ((abs(N.z) < 0.999) ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0));
|
||||
vec3 tangent = normalize(cross(up, N));
|
||||
vec3 bitangent = cross(N, tangent);
|
||||
vec3 sampleVec = tangent*H.x + bitangent*H.y + N*H.z;
|
||||
// Transform from tangent space H vector to world space sample vector
|
||||
vec3 up = ((abs(N.z) < 0.999) ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0));
|
||||
vec3 tangent = normalize(cross(up, N));
|
||||
vec3 bitangent = cross(N, tangent);
|
||||
vec3 sampleVec = tangent*H.x + bitangent*H.y + N*H.z;
|
||||
|
||||
return normalize(sampleVec);
|
||||
return normalize(sampleVec);
|
||||
}
|
||||
|
||||
void main()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* Copyright (c) 2017 Victor Fisac
|
||||
*
|
||||
* 19-Jun-2020 - modified by Giuseppe Mastrangelo (@peppemas) - VFlip Support
|
||||
* 19-Jun-2020 - modified by Giuseppe Mastrangelo (@peppemas) - VFlip Support
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue