flip order of matrix multiplication

This commit is contained in:
ktyl 2021-08-07 18:30:43 +01:00
parent fe57abce61
commit 21b8c0910d
1 changed files with 5 additions and 3 deletions

View File

@ -148,7 +148,8 @@ vec3 sampleHemisphere(vec3 normal)
vec3 tangentSpaceDir = vec3(cos(phi)*sinTheta, sin(phi)*sinTheta, cosTheta);
// TODO: this lookin sketch af rn
return tangentSpaceDir * getTangentSpace(normal);
mat3 ts = getTangentSpace(normal);
return ts* tangentSpaceDir;
}
vec3 scatterLambert(inout Ray ray, RayHit hit)
@ -157,7 +158,6 @@ vec3 scatterLambert(inout Ray ray, RayHit hit)
ray.direction = sampleHemisphere(hit.normal);
ray.energy *= 2.0 * hit.albedo * sdot(hit.normal, ray.direction);
// TODO: ???
return vec3(0.0);
}
@ -186,7 +186,7 @@ void main()
uv.x = (float(pixel_coords.x * 2 - dims.x) / dims.x) * dims.x/dims.y; // account for aspect ratio
uv.y = (float(pixel_coords.y * 2 - dims.y) / dims.y);
int samples = 2;
int samples = 1;
int bounces = 2;
for (int i = 0; i < samples; i++)
@ -203,6 +203,8 @@ void main()
}
}
pixel /= samples;
// TODO: write depth to texture
//float depth = hit.distance/INF;
//pixel = vec4(hit.albedo,1.0);