Planetside Software Forums

General => Terragen Discussion => Topic started by: WAS on March 25, 2018, 04:07:10 AM

Title: Repeat Function Idea
Post by: WAS on March 25, 2018, 04:07:10 AM
A really cool idea would be a repeat function. It would save time and space on so many projects I'd imagine (especially mine).

Basically you have a input like a surface layer, a shader/function input, and integer for number of iterations. Than TG in it's infinite glory applies said shader X times to the input (or last result). This would be useful for many shaders, for example, the transform input shader. Ever iteration it applies to the last result, or input, layering up the shaders effect.

Maybe there could be three types, a "Repeat Shader", "Repeat Scalar" and "Repeat Vector"

Image for visual example
Title: Re: Repeat Function Idea
Post by: Hetzen on March 25, 2018, 10:38:46 AM
Something like the transform input shader, but with offset and number of octaves would be cool, but then you get into how do you mix those octaves?
Title: Re: Repeat Function Idea
Post by: luvsmuzik on March 25, 2018, 12:12:18 PM
The old Rock&Sea file share uses octaves that I am sure you both understand.

But could you, because I really have no clue, use an array for this?
Title: Re: Repeat Function Idea
Post by: WAS on March 25, 2018, 02:52:46 PM
Quote from: luvsmuzik on March 25, 2018, 12:12:18 PM
The old Rock&Sea file share uses octaves that I am sure you both understand.

But could you, because I really have no clue, use an array for this?

I don't believe so. An array works off position and repeating. What I am talking about is taking a workflow which is long and drawn out and simplifying it. The repeat shader only simply merges the shader/function with the input shader X times. Doesn't have to be a transform shader. That's just an example which can be used with shaders for stepping colors or mixing many or something.
Title: Re: Repeat Function Idea
Post by: luvsmuzik on March 25, 2018, 04:21:10 PM
Yes, I thought array was just grid or directional. I wonder if there would be a way to "seed" and "constant" or "build." It just gets confusing to me especially as I know some about multiply, difference, screen and that about color hues where those terms do not always mean what one would think when looking at a term.
Title: Re: Repeat Function Idea
Post by: WAS on March 25, 2018, 04:53:45 PM
Quote from: luvsmuzik on March 25, 2018, 04:21:10 PM
Yes, I thought array was just grid or directional. I wonder if there would be a way to "seed" and "constant" or "build." It just gets confusing to me especially as I know some about multiply, difference, screen and that about color hues where those terms do not always mean what one would think when looking at a term.

When I say merge, I mean as any node does when you put them together and than pipe said node elsewhere. Though merging functionality would be cool. I've talked about the ability for all nodes to have a "Seed" function, which could than be used by functions to create all sort of dynamics.

Here is an example, this node network could simply be one or two repeats with different transform settings. Which would save so much time on adding/removing to get what I want.
[attachimg=1]

And that's really a basic example, I want to go deeper but it takes time and previews instead of just changing a number for iterations. Just seems like something that should be part of the functions setup.
Title: Re: Repeat Function Idea
Post by: Oshyan on March 25, 2018, 05:14:51 PM
I think what you want is a "loop" function, correct? I believe it has been discussed, but it can be quite "dangerous" to support since it can make compute time really increase massively with simple setting changes. It does have some value, certainly, but would need to be used carefully.

- Oshyan
Title: Re: Repeat Function Idea
Post by: WAS on March 25, 2018, 05:24:50 PM
Quote from: Oshyan on March 25, 2018, 05:14:51 PM
I think what you want is a "loop" function, correct? I believe it has been discussed, but it can be quite "dangerous" to support since it can make compute time really increase massively with simple setting changes. It does have some value, certainly, but would need to be used carefully.

- Oshyan

Yeah, that's probably a far better term to be using, yes. Basically like a for loop. Heck even while loops with the conditional scalar functionality would be incredibly powerful.

To that note about the dangers; I think it would be safe to say something like this should be inherently limited to X iterations. Maybe 10 (a slider bar?). Easy to stack up 10 nodes for 100 iterations than 100 nodes and settings.
Title: Re: Repeat Function Idea
Post by: Dune on March 26, 2018, 02:23:16 AM
Loops are dangerous indeed; I once made a loop in code to open a new window (I believe it was in Flash), and I couldn't stop it running, had to force close down the machine.
Title: Re: Repeat Function Idea
Post by: WAS on March 26, 2018, 02:55:01 AM
Quote from: Dune on March 26, 2018, 02:23:16 AM
Loops are dangerous indeed; I once made a loop in code to open a new window (I believe it was in Flash), and I couldn't stop it running, had to force close down the machine.

Action Script is dangerous haha. Loops are inherently dangerous, which is why you hard code limitations in. For example, you usually express a loop with a upper limit, and safe guard breaks within the function.