|
![](/i/fill.gif) |
> I have discussed with the team about the idea of adding alternative,
> higher-quality random number generators to POV-Ray 3.7. The current
> generator
> would be kept for backwards compatibility, but alternatives would be
> offered.
>
> The only thing which is a bit open is the exact syntax for this. So far
> this is the best idea:
>
> Enhance seed() so that it will take an optional second parameter, which
> would specify the RNG algorithm used. It would default to the current RNG.
> The rand() function would remain unchanged (internally it smartly selects
> the proper RNG from the type of seed given to it). In other words, you
> would
> be able to do, for example, like this:
>
> #declare S1 = seed(1234); // Use the current RNG
> #declare S2 = seed(1234, 1); // Identical to the above.
> #declare S3 = seed(1234, 2); // Use second RNG algorithm.
>
> Additional algorithms might be added in the future. As mentioned, rand()
> would be unchanged, so its usage would be the same:
>
> #declare RandomValue1 = rand(S1);
> #declare RandomValue2 = rand(S3);
>
> The current RNG uses a 32-bit seed, so a single parameter to seed() is
> enough to get all possible streams. However, higher-quality random number
> generators usually support much longer seeds, so it would be possible to
> choose among a vastly larger amount of RNG streams. Thus it would be very
> nice if larger seeds could be specified.
>
> The problem here is one of syntax. How to do this? Here are the ideas
> so far:
>
> 1) Simply don't support seeds larger than 32-bit. This would work, but
> would
> be a bit of a bummer because the capabilities of higher-quality RNGs
> wouldn't be fully utilized.
>
> Alternatively, since seed() actually takes a (64-bit) float rather than
> a 32-bit integer, the seed range could be somewhat enlarged by taking
> the entire float range into account. This would allow using seeds of
> about 52 bits. (But it's still a long shot from the thousands of bits
> supported by higher-quality RNGs.)
>
> 2) Make it possible to give either a regular float (as now), or an array
> of floats as the first parameter of seed(). This way larger seeds can
> be specified as an array.
>
> While a bit cumbersome, it's not as bad as it may sound at first,
> because
> it's possible to do eg. this:
>
> #declare S = seed(array[4] { 1, 2, 3, 4 }, 2);
>
> It would still be nicer if something less cumbersome could be used,
> though...
>
> 3) Use an alternative function for long seeds. For example:
>
> #declare S = longseed(2, 1, 2, 3, 4);
>
> (where the first parameter specifies the RNG type used.)
>
> One small cosmetic problem with this is, however, that it's a bit
> inconsistent with the seed() function. seed() takes the RNG type as
> the second parameter, while longseed() would take it as the first
> parameter. This can be a bit confusing.
>
> 4) Create an entirely new syntax for specifying a group of values. This,
> however, would be laborious and should preferably be avoided.
>
>
> Opinions and additional ideas will be appreciated.
IMO, there's no real need for access to larger seeds...
for example mersenne twister (MT19937) is seeded from
a single 32 bit value, even though it generates 624 values for
the internal state. There's more call for access to the RNG
state, but I can't see a way to keep compatability with 3.6 syntax.
So, for now...
RNG_Identifier = seed( Float | Float_Identifier [,Float | Float_Identifier])
I'd like to see a reworking of the syntax for this in 4.0,
in general I think it's bad to have numbered parameters as
was done for media scattering models. I prefer more descriptive
wording. I also think that using optional parameters between ()
as if they were between {} looks ugly.
Ultimately for 4.0 I'd like to see all the command-line, and
ini file options moved into SDL, so that command-line, and
ini file options are always considered to over-ride settings
in SDL. Then separate the scope of such commands into
sections... animiation{}, environment{},scene{},post_process{}.
Seed is probably one of the commands that would belong in
the environment section, along with camera, photons, and radiosity.
It's part of the starting state of the renderer.
RNG_Identifier = random_number_generator {
[type POV36 | mersenne_twister]
seed Float | Float_Identifier
};
It's a bit more verbose, but it's more amenable to be
extended in the future.
Post a reply to this message
|
![](/i/fill.gif) |