Update basis calc

This commit is contained in:
luboslenco
2020-01-02 23:45:57 +01:00
parent c07c7aab71
commit 09707e008d
2 changed files with 8 additions and 4 deletions
Binary file not shown.
+8 -4
View File
@@ -5,10 +5,14 @@
#include "rand.hlsl"
void create_basis(float3 normal, out float3 tangent, out float3 binormal) {
tangent = abs(normal.x) > abs(normal.y) ?
normalize(float3(0., normal.z, -normal.y)) :
normalize(float3(-normal.z, 0., normal.x));
binormal = cross(normal, tangent);
// tangent = abs(normal.x) > abs(normal.y) ?
// normalize(float3(0.0, normal.z, -normal.y)) :
// normalize(float3(-normal.z, 0.0, normal.x));
// binormal = cross(normal, tangent);
float3 c1 = cross(normal, float3(0.0, 0.0, 1.0));
float3 c2 = cross(normal, float3(0.0, 1.0, 0.0));
tangent = length(c1) > length(c2) ? c1 : c2;
binormal = cross(tangent, normal);
}
float schlick_weight(float cosTheta) {