Review PBR shaders
Issue was related to vertex tangent attibutes not uploaded to GPU, a quick solution was implemented for new vertex attributes loading for already existing meshes... I don't like it specially but it will work for now.
This commit is contained in:
parent
0f9fe34c3a
commit
c600dd0766
6 changed files with 41 additions and 6 deletions
|
@ -10,13 +10,13 @@
|
|||
|
||||
#version 330
|
||||
|
||||
#define MAX_SAMPLES 1024u
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec2 fragTexCoord;
|
||||
|
||||
// Constant values
|
||||
const float PI = 3.14159265359;
|
||||
const uint MAX_SAMPLES = 1024u;
|
||||
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
@ -93,7 +93,7 @@ vec2 IntegrateBRDF(float NdotV, float roughness)
|
|||
vec3 V = vec3(sqrt(1.0 - NdotV*NdotV), 0.0, NdotV);
|
||||
vec3 N = vec3(0.0, 0.0, 1.0);
|
||||
|
||||
for (int i = 0; i < MAX_SAMPLES; i++)
|
||||
for (uint i = 0u; i < MAX_SAMPLES; i++)
|
||||
{
|
||||
// Generate a sample vector that's biased towards the preferred alignment direction (importance sampling)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#version 330
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec3 fragPos;
|
||||
in vec3 fragPosition;
|
||||
|
||||
// Input uniform values
|
||||
uniform samplerCube environmentMap;
|
||||
|
@ -23,7 +23,7 @@ out vec4 finalColor;
|
|||
void main()
|
||||
{
|
||||
// The sample direction equals the hemisphere's orientation
|
||||
vec3 normal = normalize(fragPos);
|
||||
vec3 normal = normalize(fragPosition);
|
||||
|
||||
vec3 irradiance = vec3(0.0);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#define CUBEMAP_RESOLUTION 1024.0
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec3 fragPos;
|
||||
in vec3 fragPosition;
|
||||
|
||||
// Input uniform values
|
||||
uniform samplerCube environmentMap;
|
||||
|
@ -79,7 +79,7 @@ vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness)
|
|||
void main()
|
||||
{
|
||||
// Make the simplyfying assumption that V equals R equals the normal
|
||||
vec3 N = normalize(fragPos);
|
||||
vec3 N = normalize(fragPosition);
|
||||
vec3 R = N;
|
||||
vec3 V = R;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue