Sphinx.
Filter Optimizer

|
Use of math.random will create variations from rendering to rendering even though global variation slider has not been changed. I think the lua math.randomseed value should be preinitialized by the variation slider by default.
|
Posted: June 13, 2010 3:42 am |
Details
E-Mail
|
ThreeDee
Lost in Space

|
Hi Sphinx,
I ran into that same thing, this is what Vlad had to say.
I do agree it should be connected by default.
Quote |
---|
ThreeDee wrote:
Quote |
---|
Vladimir Golovin wrote:
You can the VARIATION variable, which is visible to scripts that have the "Makes use of the global Variation setting" flag turned on in their Script Settings. |
Ok, thanks, I got that now. You can control the variations by calling math.randomseed(VARIATION) during prepare.
Without this, the random numbers were different EVERY time, even when using a stored preset, which is fine if you wanted it to be that way, but if the variation happed to the exact one you wanted to keep...
TD |
|
Posted: June 13, 2010 5:56 am |
Details
E-Mail
|
Sphinx.
Filter Optimizer

|
Can you call math.randomseed(VARIATION) without script error?
I get the following error:
"bad argument #1 to 'randomseed' (number expected, got nil)." (btw Vlad, can you add a 'Copy Message' to the context menu of the Message Log?)
I guess its because I haven't set that flag.. where do you set "Makes use of the global Variation setting"?
|
Posted: June 13, 2010 6:12 am |
Details
E-Mail
|
Totte
Übernerd

|
THreeDee, I have the same question as Sphinx, I tried this before you wrote this and got the same errors as Sphinx.
- I never expected the Spanish inquisition
|
Posted: June 13, 2010 6:22 am |
Details
E-Mail
|
James
James
|
Quote |
---|
Sphinx. wrote:
where do you set "Makes use of the global Variation setting"? |
On the scripts tab with the code at the bottom there is a 'Settings...' button, click that and it is a option.
|
Posted: June 13, 2010 6:25 am |
Details
E-Mail
|
ThreeDee
Lost in Space

|
Yes, that's the place, right under your script input field when you are in edit mode and have a Script component selected. The global Size slider and a few other things are there, too.
|
Posted: June 13, 2010 6:47 am |
Details
E-Mail
|
Sphinx.
Filter Optimizer

|
|
Posted: June 13, 2010 10:24 am |
Details
E-Mail
|
Vladimir Golovin
Administrator
|
Quote |
---|
Sphinx. wrote:
Use of math.random will create variations from rendering to rendering even though global variation slider has not been changed. |
That shouldn't happen. We'll investigate this.
|
Posted: June 13, 2010 2:07 pm |
Details
E-Mail
|
Dmitry Sapelnikov
Filter Forge, Inc. AKA Egret
|
Sphinx, could you post your script?
|
Posted: July 9, 2010 8:13 am |
Details
E-Mail
|
Sphinx.
Filter Optimizer

|
yeah, but I'm not sure this is really a problem anymore
function prepare()
math.randomseed(VARIATION)
rx = math.random() - 0.5
ry = math.random() - 0.5
end;
function get_sample(x, y)
return get_sample_map(x + rx, y + ry, SOMETHING)
end;
if "Makes use of the global variation setting" is not checked, you will get a script error because VARIATION is nil, but I don't think thats a bug - any other nil variable would cause this too, its expected behaviour I'd say. But perhaps you should set VARIATION even when the "Makes use.." option is not checked?
Now if you do not set the randomseed at all (but have "Makes use.." checked), the position will change for every new rendering. This non deterministic behaviour is not ok I think. You should initialize the randomseed with a constant before rendering.
|
Posted: July 9, 2010 8:39 am |
Details
E-Mail
|
Dmitry Sapelnikov
Filter Forge, Inc. AKA Egret
|
Thanks for the quick response.
Quote |
---|
Sphinx. wrote:
if "Makes use of the global variation setting" is not checked, you will get a script error because VARIATION is nil |
 It's by design
Quote |
---|
Sphinx. wrote:
Now if you do not set the randomseed at all (but have "Makes use.." checked), the position will change for every new rendering. This non deterministic behaviour is not ok I think. You should initialize the randomseed with a constant before rendering. |
I've checked it. Cute bug  Of course, we're fixing it.
|
Posted: July 9, 2010 9:12 am |
Details
E-Mail
|