Planetside Software Forums

General => Terragen Discussion => Topic started by: kaedorg on December 13, 2013, 04:24:59 AM

Title: Seed and random seed limitation to 256 ?
Post by: kaedorg on December 13, 2013, 04:24:59 AM
Let me explain why i'm asking this.
Sometimes i start with a project with some old tgc files and i put them together and try to create a new view.
From then, as i don't think the first view could be the best, i try to modify some seeds.
On a project, i try to change the fractal terrain seed. Rather than using the random, i start from 1 and increase until it seems good in the preview window.
Then I make a quick render and i save it with the seed information.
This morning i was doing this and finishing a render with seed 315. Immediately it came to my mind that i saw this view recently.
Checking my other renders i admit that seed 59 and 315 are exactly the same. Not long to see that between 59 and 315 the gap is 256.

So i check with the opening terrain in tg3 seed 119, seed 375 and seed 631 are the same.

Then my question is : is there a useful limitation to 256 and rather than random can we only check between 1 and 256 for any seed to get the more appropriate ?

David
Title: Re: Seed and random seed limitation to 256 ?
Post by: cyphyr on December 13, 2013, 05:12:40 AM
Very interesting find.
We've all noticed that differing seeds seem to sometimes produce the same result. Now we know why.
Title: Re: Seed and random seed limitation to 256 ?
Post by: Dune on December 13, 2013, 05:32:28 AM
That is really striking! Great find indeed, but a rather disconcerting one as well. Just checked of course, and it seems we only have 256 seeds indeed. Mmmmm. Based on color depth of 256?
Title: Re: Seed and random seed limitation to 256 ?
Post by: TheBadger on December 13, 2013, 07:55:58 AM
If its only 256, then couldn't that be documented. I mean for each place there is a seed, then a render of the effect from default?

I had thought that the seeds were basically infinite variety, even if only in subtle ways. But 256 sounds like it could be doucumented by visual example.... Every one take 10 numbers and go?
Title: Re: Seed and random seed limitation to 256 ?
Post by: masonspappy on December 13, 2013, 08:15:38 AM
Not sure where exactly you  are inputting your value.   Can you specify a fraction, say 127.123 and get a different result?
Title: Re: Seed and random seed limitation to 256 ?
Post by: Dune on December 13, 2013, 09:54:13 AM
Don't know if fractions work as seed. But input is in the seed text field in a PF. If you enter any number and add x (whole number) times 256, they'll all be the same.
Title: Re: Seed and random seed limitation to 256 ?
Post by: j meyer on December 13, 2013, 10:15:16 AM
Interesting find,indeed!Especially the relation.
Title: Re: Seed and random seed limitation to 256 ?
Post by: jaf on December 13, 2013, 11:33:13 AM
Gee, I always thought using 666 for a seed would be unique, now I find 154 or 2970 is the same?
Wouldn't that be a bug, if only because clicking the Random Seed but generates up to a five digit integer (not meaning it's limited to 256 -- just misleading)?

[edit] that was a clumsy question on my part.  What I was attempting to say was, if 256 random values is a program constraint, why generate 5 digit numbers?
Title: Re: Seed and random seed limitation to 256 ?
Post by: cyphyr on December 13, 2013, 11:44:36 AM
Remember the seed value is only one aspect of the PF generation.  There's plenty of extra variation that can be added with the rest of the settings. And of course adding two or more either chained or with the merge shader gives near infinite variety.
Title: Re: Seed and random seed limitation to 256 ?
Post by: kaedorg on December 13, 2013, 12:06:08 PM
I completely agree with Richard. Opening this thread didn't mean to reduce the power of TG3.
And if in the opening basic project, there are only 2 seeds (fractal terrain and base colours) which already means 256 x 256 = 65536 possibilities.
We all know that our projects have many more seeds which means an infinite variety. And some variations as scale for example and camera position
don't use seeds.
This 256 trick can just be useful for testing more elements rather than using the random seed button (as fractal terrains or clouds) before choosing your ideal one.

I work a lot by this way and archive all renders with seeds differences. I think it is useful to select the best and sometimes another seed opens a new project and so on ....

TG3 potential is not reduced as it is still infinite.

David
Title: Re: Seed and random seed limitation to 256 ?
Post by: jaf on December 13, 2013, 12:19:07 PM
I wasn't trying to be negative -- just pointing out how misleading those random seed number are.  I just looked at a density shader (cloud fractal shader) and it has the same 256 limitation.  There's always a chance it's a programming error -- maybe an integer cast to a byte, so it's good to question these things.
Title: Re: Seed and random seed limitation to 256 ?
Post by: cyphyr on December 13, 2013, 01:12:23 PM
I have suspected this (or something like this) for a long time. Good to have it confirmed.
It appears to NOT be true of the seed used in populations.
Title: Re: Seed and random seed limitation to 256 ?
Post by: PabloMack on December 13, 2013, 04:16:06 PM
Quote from: masonspappy on December 13, 2013, 08:15:38 AM
Not sure where exactly you are inputting your value.   Can you specify a fraction, say 127.123 and get a different result?

Seed numbers are always integers and it appears that, sometimes, only their low-order 8-bits are used. I wouldn't assume that every use of a seed number only looks at the low-order 8-bits, though. Seed numbers are used in many places in TG. For those of you who are not programmers, 8-bit numbers go from 0~255 and not from 1~256. 256 is a number that won't fit into 8-bits and is basically zero with the carry-bit (out of the high-order bit) set. One of my favorite expressions is "Real programmers start counting with zero and not one". It was a non-programmer who decided to design a keyboard that starts with 1 (on the left) and ends with 0 (on the right after the 9). Human technology is riddled with such imperfections. No wonder V'ger wanted to destroy us. We are "infesting" this planet. ;)
Title: Re: Seed and random seed limitation to 256 ?
Post by: jaf on December 13, 2013, 07:04:08 PM
Similar to the rotation in populations.  The entry fields default to Minimum Y rotation: 0 and Maximum Y rotation: 360.  I always assumed that meant from zero to, but not including 360, since that would be 360 degrees and an entry of 360 would "wrap around" to zero.  I think that's correct.
Title: Re: Seed and random seed limitation to 256 ?
Post by: PabloMack on December 13, 2013, 07:20:07 PM
Yes. 0 and 360 are the same orientation. But in animations you have to be careful because if you key an object at 0 then later at 360 interpolation will be done between the two and the object will rotate between the two key frames. If you were to divide an angle (stored as a float) in degrees by 360.0 then the fraction will describe the orientation of an object and the integral part will imply the number of rotations.
Title: Re: Seed and random seed limitation to 256 ?
Post by: Matt on December 14, 2013, 09:00:24 PM
The Power Fractal Shader only has 256 unique seeds. After that the seeds repeat. I wasn't aware of that limitation when I made the Random Seed button generate values between 0 and 65535. The Alpine Fractal Shader and Fake Stones Shader have this limitation too, and probably other shaders that use noise functions. But other nodes in Terragen might have a larger number of seeds.

Matt
Title: Re: Seed and random seed limitation to 256 ?
Post by: kaedorg on December 16, 2013, 05:52:25 AM
Thanks Matt for this confirmation.

David
Title: Re: Seed and random seed limitation to 256 ?
Post by: D.A. Bentley (SuddenPlanet) on March 04, 2019, 10:25:14 PM
Quote from: Matt on December 14, 2013, 09:00:24 PM
The Power Fractal Shader only has 256 unique seeds. After that the seeds repeat. I wasn't aware of that limitation when I made the Random Seed button generate values between 0 and 65535. The Alpine Fractal Shader and Fake Stones Shader have this limitation too, and probably other shaders that use noise functions. But other nodes in Terragen might have a larger number of seeds.

Matt

I verified today that Easy Cloud doesn't have the 256 seed limitation.  Maybe because that was new in TG4 it got the full 65535+?  It would take a long time to render 1 - 65536 so I didn't do that, but I did render frames -256 to 512 and saw no repeats.  Then I rendered some frames in the range 65530 - 65540 and couldn't exactly match any of those up to the frames down close to the "zero seed".

So I have no idea how many variations there are but I suspect it is in the millions or more.  Any ideas Matt?

Now I'm curious about Cloud layer v3.  :)

-Derek
Title: Re: Seed and random seed limitation to 256 ?
Post by: Matt on March 04, 2019, 11:16:28 PM
The Easy Cloud contains 3 built-in fractals (at the moment). All of the built-in fractals are limited to 256 seeds each (because they suffer from the same limitation as the Power Fractal). However, I added some extra randomness by calculating a random seed for just one of the built-in fractals based on the 32-bit input seed. This makes it harder to find duplicates, but they still occur quite often. Theoretically there are now 65536 combinations, but the duplicates will exist in somewhat random places, so you'd need to try a much larger set of seeds if you wanted to find them all.
Title: Re: Seed and random seed limitation to 256 ?
Post by: D.A. Bentley (SuddenPlanet) on March 04, 2019, 11:37:30 PM
Oh ok, I was rendering the Cumulus TG 3.9.07 Type.  That must be the one with more randomness right?

-Derek
Title: Re: Seed and random seed limitation to 256 ?
Post by: Matt on March 05, 2019, 12:07:14 AM
I'm not sure but I think they all do (in Easy Cloud).
Title: Re: Seed and random seed limitation to 256 ?
Post by: D.A. Bentley (SuddenPlanet) on March 05, 2019, 03:42:56 AM
Quote from: Matt on March 05, 2019, 12:07:14 AM
I'm not sure but I think they all do (in Easy Cloud).

Ok I understand.  I misunderstood what you were saying about three different fractals, and how one of them was full 32-bit and blended with the other two.  For some reason my brain interpreted that as referring to the three different types of clouds within Easy Cloud (Al, Cu, St), but after re-reading it and doing some rendering I get it now.  The attached picture shows how the "Roll Around" seeds look similar in some cases, but still have unique parts.  In that image the third column is just a blending of the two seeds being compared from column 1 & 2.

I only rendered 30 with what I thought would be duplicate "Roll Around" seeds, but of those I could only see in 7 of the clouds some similarities, and even then it was hard to spot without careful examination.  This is very good for rendering random cloud sprites!!!

Thanks Matt!

-Derek
Title: Re: Seed and random seed limitation to 256 ?
Post by: Matt on March 05, 2019, 09:59:43 PM
Thanks. I do what I can :)