|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
geogeo <geo### [at] mecolcouk> wrote:
> Thanks for info on #debug, had not noticed that feature, only been at this a few
> days. But how do I get it to output variables? The following #debug fails:
> #declare R1 = seed(1);
> #declare n = rand(R1);
> #debug "rand out = ",str(n),"\n";
#debug takes one single string as parameter. To build a string made of
several components, you use the concat() function:
#debug concat("rand out = ", str(n, 0, -1), "\n")
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wasn't it geogeo who wrote:
>
>So is there any way at all to produce a randomised number within POV?
Some versions of MegaPOV had a tick_count variable which returns the
value of the computer's internal clock variable.
In official versions of POV, one thing you can do is pass an external
value into the scene with a command line "Declare" and use that value as
the seed. If you launch POV from a programming language that has access
to the computer's internal clock variable, you could pass that value
into the scene that way.
Another approach would be to store the seed in an external file. Read
the value with fopen and fread, use it as the seed for the current scene
then change the value (e.g. by adding 1) and write it back. That way,
the next time you run that scene you get a different seed value. That
also has the advantage that if you decide that the version of your scene
that you rendered three iterations ago had a particularly pretty random
pattern that you'd like to go back to, you can examine the file and work
out what the seed would have been.
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp <war### [at] tagpovrayorg> wrote:
> geogeo <geo### [at] mecolcouk> wrote:
> > Thanks for info on #debug, had not noticed that feature, only been at this a few
> > days. But how do I get it to output variables? The following #debug fails:
>
> > #declare R1 = seed(1);
> > #declare n = rand(R1);
> > #debug "rand out = ",str(n),"\n";
>
> #debug takes one single string as parameter. To build a string made of
> several components, you use the concat() function:
>
> #debug concat("rand out = ", str(n, 0, -1), "\n")
>
> --
> - Warp
Thanks for concat info - works fine now!
Geo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"geogeo" <geo### [at] mecolcouk> wrote:
> I am using a rand generated value 'n' but the result is always the same. I've
> put in a text trace to output the value 'n' as follows:
>
> #declare R1 = seed(1);
> #declare n = rand(R1);
I remember that the concept of using seed() and rand() was a bit difficult to
grasp when I started out with POV-Ray (there is no real 'how-to' in the
documentation.)
Here's a simple example:
#declare R1 = seed(27);
pigment{color rgb <rand(R1),rand(R1),rand(R1)>}
Each rand is a different value--but those three different values will always be
the 'same', since they use the same seed() value. Change seed() and you get
three *new* and different rand() values.
Ken
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Kenneth wrote:
> Each rand is a different value--but those three different values will always be
> the 'same', since they use the same seed() value. Change seed() and you get
> three *new* and different rand() values.
I actually thought I'd be clever and trick pov into providing
a seed based on the pixel value of a jittered 2x2 pixel image
rendered in a first pass ;) However, it seems the internally
used random numbers are not seeded by a timer either, so when
rendered after a restart the results were again predictable.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Kenneth" <kdw### [at] earthlinknet> wrote in message
news:web.4b48e504cc0023fa65f302820@news.povray.org...
> I remember that the concept of using seed() and rand() was a bit difficult
> to
> grasp when I started out with POV-Ray (there is no real 'how-to' in the
> documentation.)
>
> Here's a simple example:
>
> #declare R1 = seed(27);
>
> pigment{color rgb <rand(R1),rand(R1),rand(R1)>}
>
> Each rand is a different value--but those three different values will
> always be
> the 'same', since they use the same seed() value. Change seed() and you
> get
> three *new* and different rand() values.
After reading carefully this example in seems to be saying the same thing:
http://wiki.povray.org/content/Documentation:Reference_Section_2#Functions
I also started a talk page:
http://wiki.povray.org/content/Documentation_Talk:Reference_Section_2
Just in case you might think it could be better worded!
Jim
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Jim Holsenback" <jho### [at] povrayorg> wrote:
> After reading carefully this example in seems to be saying the same thing:
>
> http://wiki.povray.org/content/Documentation:Reference_Section_2#Functions
>
Ah, so it does! :-)
I think the explanations given in the docs could probably be less 'technical',
so as to make more sense to newbies.
Here's how rand() begins:
"Returns the next pseudo-random number from the stream specified by the positive
integer I. You must call seed() to initialize a random stream before calling
rand()."
Egads, that's a lot of tech-speak. First off, it *kind of* sounds like the user
is--or needs to be--already privvy to the 'stream' he's looking for--i.e., "I
need the stream specified by the positive integer 27." Of course, we don't know
what the contents of that stream are (or even what a 'stream' is, if we're REAL
newbies!) so it all sounds confusing/mysterious/unknowable.
Next up is the arcane phrase, "You must call seed..." Unless the newbie is
already familiar with programming, that word 'call' is rather mysterious. In POV
lingo, it would mean #declare *some variable name* = seed(32). (IF you already
know that, of course!) Personally, I didn't have the faintest idea what 'call'
meant when I started out...and it made me feel quite 'out of my depth', as if
there was some secret code I had to decipher. Such little dead-end details as
these can be off-putting to a beginner.
Oh, and here's another, from seed:
"seed(I) Initializes a new pseudo-random stream with the initial seed value A."
A or I? What is A?? (Probably a typo, I know--but when one is fishing around for
the meaning of a difficult-to-grasp topic, such a little mystery adds to the
confusion.)
What strikes me about the POV documentation as a whole is that some sections are
written and described very clearly--from a 'humanistic' point of view; while
others seem to lifted verbatim from a programmer's handbook. Granted, the early
iterations of POV-Ray were probably meant only for knowledgeable programmers;
but the documentation is starting to show its age.
Ken
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Kenneth" <kdw### [at] earthlinknet> wrote in message
news:web.4b4b054acc0023fa65f302820@news.povray.org...
> I think the explanations given in the docs could probably be less
> 'technical',
> so as to make more sense to newbies.
Yes and you've made some valid points ....
Like I said:
http://wiki.povray.org/content/Documentation_Talk:Reference_Section_2
If you can come up with something clearer ....
Imagine that!! a chance to actually do something about a situation rather
than point out flaws and expect someone else to fix it!!
Pardon the sarcasm there Ken ... no offence intended.
Jim
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Jim Holsenback" <jho### [at] povrayorg> wrote:
> If you can come up with something clearer ....
>
> Imagine that!! a chance to actually do something about a situation rather
> than point out flaws and expect someone else to fix it!!
>
> Pardon the sarcasm there Ken ... no offence intended.
>
> Jim
Yeah, you're right--I should get off my soapbox and be more pro-active. But it
sure is fun to pontificate while others do the dirty work! :-P When I started
using POV-Ray, I thought that there were armies of magical elves
behind-the-scenes, working tirelessly to make changes and corrections, just for
me! Uh, I've grown up since then...
;-)
Seriously, though, the only hesitation I have about posting to the wiki is that,
whatever I come up with, it shouldn't be taken as *law*, but should be vetted by
people more knowledgeable than myself. I guess that *is* how it works(?) I've
never posted anything to Wikipeadia; the nuts-and-bolts of actually contributing
to a wiki is kind of mysterious to me.
But I'll make the effort, and see what happens. If I can get past this little
mental impasse--watch out!! There are LOTS of small documentation corrections
I'd like to make.
Ken
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Kenneth" <kdw### [at] earthlinknet> wrote in message
news:web.4b4ba1a6cc0023fa65f302820@news.povray.org...
> But I'll make the effort, and see what happens. If I can get past this
> little
> mental impasse--watch out!! There are LOTS of small documentation
> corrections
> I'd like to make.
excellent ... be aware that the main documents are protected, so that's why
the changes are done on an associated "talk" page. Since this is your first
go round maybe you should have a look at:
http://wiki.povray.org/content/Documentation:Developers_Notes
explains where source docs came for, some don't change admonishments, and an
example of how to do a change near the bottom of the page. I monitor "recent
changes" (usually daily) and well give my best effort to merge changes back
into the main docs.
Thanks for the contribution(s) ...
Jim
PS: The "preview" button at the bottom of the edit window is your friend ;-)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |