Manta Interactive Ray Tracer Development Mailing List

Text archives Help


Re: [MANTA] rng in thread context?


Chronological Thread 
  • From: James Bigler <bigler@cs.utah.edu>
  • To: sparker@cs.utah.edu
  • Cc: lacewell@cs.utah.edu, manta@sci.utah.edu
  • Subject: Re: [MANTA] rng in thread context?
  • Date: Fri, 09 Mar 2007 14:16:58 -0700

Before we get all the machinery in place, you can get by with the following bit of code:

#include <Core/Math/CheapRNG.h>

for(ray_index = [rays.begin, rays.end]) {
  CheapRNG rng;
  // rays.data->image = [-1,1]
  unsigned int seed = (rays.data->image[0][ray_index]+
                       rays.data->image[1][ray_index] + 4)
                      * 1073741824; // 1073741824 = 2^30
  rng.seed(seed);
}

This code will even work for jittered samples, because the little differences in data->image (coordinates on the image plane) will produce different seeds.

James

sparker@cs.utah.edu wrote:
add one to render context -bthat is where it should go.  James can point you 
to his rng classes.

Steve

-----Original Message-----

From:  Dylan Lacewell <lacewell@cs.utah.edu>
Subj:  [MANTA] rng in thread context?
Date:  Thu Mar 8, 2007 8:18 pm
Size:  418 bytes
To:  manta@sci.utah.edu


Is there a way to get a stream of random numbers in a surface shader? I don't see a random number generator exposed in the thread context, so I'm going to hack in my own for now.

I'm writing an ambient occlusion shader which jitters the occlusion rays. I can't use a local random number generator because that will give each shading point the same set of occlusion rays, which causes structured artifacts.

D







Archive powered by MHonArc 2.6.16.

Top of page