Преглед на файлове

Correct issue with tangents

pull/508/head
Ray преди 7 години
родител
ревизия
276847eca9
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. +3
    -3
      examples/models/resources/shaders/pbr.vs

+ 3
- 3
examples/models/resources/shaders/pbr.vs Целия файл

@ -12,7 +12,7 @@
in vec3 vertexPosition;
in vec2 vertexTexCoord;
in vec3 vertexNormal;
in vec3 vertexTangent;
in vec4 vertexTangent;
// Input uniform values
uniform mat4 mvp;
@ -28,7 +28,7 @@ out vec3 fragBinormal;
void main()
{
// Calculate binormal from vertex normal and tangent
vec3 vertexBinormal = cross(vertexNormal, vertexTangent);
vec3 vertexBinormal = cross(vertexNormal, vec3(vertexTangent));
// Calculate fragment normal based on normal transformations
mat3 normalMatrix = transpose(inverse(mat3(mMatrix)));
@ -39,7 +39,7 @@ void main()
// Send vertex attributes to fragment shader
fragTexCoord = vertexTexCoord;
fragNormal = normalize(normalMatrix*vertexNormal);
fragTangent = normalize(normalMatrix*vertexTangent);
fragTangent = normalize(normalMatrix*vec3(vertexTangent));
fragTangent = normalize(fragTangent - dot(fragTangent, fragNormal)*fragNormal);
fragBinormal = normalize(normalMatrix*vertexBinormal);
fragBinormal = cross(fragNormal, fragTangent);

Зареждане…
Отказ
Запис