flip order of matrix multiplication
This commit is contained in:
parent
fe57abce61
commit
21b8c0910d
|
@ -148,7 +148,8 @@ vec3 sampleHemisphere(vec3 normal)
|
||||||
vec3 tangentSpaceDir = vec3(cos(phi)*sinTheta, sin(phi)*sinTheta, cosTheta);
|
vec3 tangentSpaceDir = vec3(cos(phi)*sinTheta, sin(phi)*sinTheta, cosTheta);
|
||||||
|
|
||||||
// TODO: this lookin sketch af rn
|
// TODO: this lookin sketch af rn
|
||||||
return tangentSpaceDir * getTangentSpace(normal);
|
mat3 ts = getTangentSpace(normal);
|
||||||
|
return ts* tangentSpaceDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 scatterLambert(inout Ray ray, RayHit hit)
|
vec3 scatterLambert(inout Ray ray, RayHit hit)
|
||||||
|
@ -157,7 +158,6 @@ vec3 scatterLambert(inout Ray ray, RayHit hit)
|
||||||
ray.direction = sampleHemisphere(hit.normal);
|
ray.direction = sampleHemisphere(hit.normal);
|
||||||
ray.energy *= 2.0 * hit.albedo * sdot(hit.normal, ray.direction);
|
ray.energy *= 2.0 * hit.albedo * sdot(hit.normal, ray.direction);
|
||||||
|
|
||||||
// TODO: ???
|
|
||||||
return vec3(0.0);
|
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.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);
|
uv.y = (float(pixel_coords.y * 2 - dims.y) / dims.y);
|
||||||
|
|
||||||
int samples = 2;
|
int samples = 1;
|
||||||
int bounces = 2;
|
int bounces = 2;
|
||||||
|
|
||||||
for (int i = 0; i < samples; i++)
|
for (int i = 0; i < samples; i++)
|
||||||
|
@ -203,6 +203,8 @@ void main()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pixel /= samples;
|
||||||
|
|
||||||
// TODO: write depth to texture
|
// TODO: write depth to texture
|
||||||
//float depth = hit.distance/INF;
|
//float depth = hit.distance/INF;
|
||||||
//pixel = vec4(hit.albedo,1.0);
|
//pixel = vec4(hit.albedo,1.0);
|
||||||
|
|
Loading…
Reference in New Issue