YOUR ACCOUNT

Login or Register to post new topics or replies
Sphinx.
Filter Optimizer

Posts: 1750
Filters: 39
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.
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
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


  Details E-Mail
Sphinx.
Filter Optimizer

Posts: 1750
Filters: 39
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"?
  Details E-Mail
Totte
Übernerd

Posts: 1460
Filters: 107
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
  Details E-Mail
James
James
Posts: 676
Filters: 46
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. smile:)
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
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.
  Details E-Mail
Sphinx.
Filter Optimizer

Posts: 1750
Filters: 39
  Details E-Mail
Vladimir Golovin
Administrator
Posts: 3446
Filters: 55
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.
  Details E-Mail
Dmitry Sapelnikov
Filter Forge, Inc. AKA Egret
Posts: 76
Filters: 5
Sphinx, could you post your script?
  Details E-Mail
Sphinx.
Filter Optimizer

Posts: 1750
Filters: 39
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.
  Details E-Mail
Dmitry Sapelnikov
Filter Forge, Inc. AKA Egret
Posts: 76
Filters: 5
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

smile:) 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 smile:D Of course, we're fixing it.
  Details E-Mail

Join Our Community!

Filter Forge has a thriving, vibrant, knowledgeable user community. Feel free to join us and have fun!

33,712 Registered Users
+19 new in 30 days!

153,534 Posts
+31 new in 30 days!

15,348 Topics
+72 new in year!

Create an Account

Online Users Last minute:

9 unregistered users.