diff options
| author | Ray <[email protected]> | 2018-03-04 23:24:30 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2018-03-04 23:24:30 +0100 |
| commit | 276847eca9290e71baf40c3e9e890efe441aac41 (patch) | |
| tree | f064b65f3e3872c3e678251dcfc7df2d8e2bedaa /examples/models/resources | |
| parent | 85850a955a1c3d6e51f919385679ea9ba4d6a864 (diff) | |
| download | raylib-276847eca9290e71baf40c3e9e890efe441aac41.tar.gz raylib-276847eca9290e71baf40c3e9e890efe441aac41.zip | |
Correct issue with tangents
Diffstat (limited to 'examples/models/resources')
| -rw-r--r-- | examples/models/resources/shaders/pbr.vs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/models/resources/shaders/pbr.vs b/examples/models/resources/shaders/pbr.vs index e852ac1a..885cb199 100644 --- a/examples/models/resources/shaders/pbr.vs +++ b/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); |
