sabotage Posted February 3, 2010 Share Posted February 3, 2010 Hello guys I am trying to implement somekind of structured or wavelet importance sampling. For a start I tried using raydirections with gather function in renderman pro server 14.5 . Anyway the results are always grainy no matter how much samples I use. Can someone help or suggest a solution for an importance sampling via gather if it is possible. Here is the function I tried first. computeIsotropicWardDirs(float samples, alpha; vector I; normal Ns; vector dPdu, dPdv; output vector raydirs[1024]; ) // results { vector ndir = vector(Ns), udir = normalize(dPdu), vdir; vector In = normalize(I), IinPlane, hdir; uniform float s; float delta, phi, r; // (delta is angle from the "up" axis) float u, v, n; // Create an orthonormal basis udir = udir - (Ns.udir) * Ns; // project udir onto plane perp. to normal normalize(udir); vdir = Ns ^ udir; // Compute directions for (s = 0; s < samples; s += 1) { // Compute (delta,phi) specifying the half vector h delta = atan(alpha * sqrt(-log(random()))); phi = 2 * 3.141592 * random(); // Compute half vector h n = cos(delta); r = sin(delta); u = r * cos(phi); v = r * sin(phi); hdir = u * udir + v * vdir + n * ndir; // Convert to a reflection direction raydirs[s] = reflect(In, hdir); } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.