Is it possible to create a “random” direction on the hemisphere based on
the point position on a surface, rather than using frand()? So that it
is not so random locally, but in overall, it appear random enough?
I’m trying to make it so that if a ray hit a point (or within a radius)
the random hemisphere reflected ray will be the same everytime.
Please log in or register to post a reply.
You could create a grid of evenly spread directions, then jitter each
one based on some Perlin noise function.
Bu I don’t think it sounds like a great idea. If you use it for sampling
in a raytracer, you’ll get weird artifacts.
I was thinking of doing this for my render, because, when a ray hit a
glossy surface, it shoot a random ray, so now it looks grainy like a
photon or path tracer! I don’t know how to make it otherwise!
Yes, less random directions would make it look less grainy. But you
would instead get banding. There’s really no way around this.
I know what you mean. So how do some renders produce super fast shadows
that are so smooth??
I think you can try following method.
First, pregenerate array of evenly distributed rays in full unit sphere,
Second, generate random rotation matrix M. For that you must
generate true random point on 4D sphere (quaternion), it might be tricky
but quite doable.
Third, spawn rays with directions dir= normalize(N + M *
defRay), where **N is unit surface normal.
That way you have rays distributed in hemisphere with density
proportional to cos(N\^dir) which is ideal for diffuse surfaces.
True random rotation on every ray hit ensures mathematic correctness and
I see what you mean. I’ll give that a try, thanks!