Fix spherical random

This commit is contained in:
numzero 2024-12-23 22:24:56 +03:00
parent d390df6564
commit cec72b0661

View File

@ -122,9 +122,9 @@ fn rand_float() -> f32 {
fn rand_sphere() -> vec3f {
loop {
let v = vec3f(rand_float(), rand_float(), rand_float());
let v = vec3f(rand_float(), rand_float(), rand_float()) - 0.5;
let l = length(v);
if (length(v) <= 1.0) {
if (length(v) <= 0.5) {
return v / l;
}
}