TrapShapePlayground

From Ultrafractal Wiki

Jump to: navigation, search

also see Trap Shape PlugIn


Evie asked for some example UPRs to explain what I've been talking about. So, here we go. We'll start with this one:

TrapShapePlayground {
; www.fractalus.com
::HdttShn2deVzutNMM47FovDG+BI12bppbD6yaXLQBKWB6uHoYRnoVZJBJl+zb/oktjTadck3
 pEa+9RRRRSJWZolOq47nfWSij7EAJ9PGq+pNUNk8og++ajarklm8Kn52QuKLLZDwXvxF+LqH
 MWSundpBYcnlkeDtmDykHmlcvSC2f8tLWcRRW2VpnfWAfYtKpaHXJJp/kW+c3ao00Su7dSOa
 6awtRxI1bFOumatnfWNVr5y1N0BpDMksLQg01SvHUpMIYaQdN9NuXfeSFXASaNuteyRlMqhN
 bbVdaCy38OJ9OQCGe5tNcT9c1Lbt01CcZ3nnY137EW+A+LIWZUuBIN7llrbMcYr8JltielDS
 mxfBMoFc7B8josOqx5DADYB9St6Vc7XcR2nVtiyFqtOSOUgc5SLnBNH/Gq0Wh0EcJQNJGQDU
 HRqSsKBnR+ax3yv8q5fZx8BjqliQk4wA7dGKDTGcXrEKDe41GsKbFbDxs6/OPEev5h7X+bzK
 uznDaHj0nCxfUbncfQ+T8b9tTjE9vlKvb58u1pwXtMADEQp7D7tQpVQR6pYe4GMW0UnyEJe/
 maPHNGS6gAVI8FXUf9Le4hiJ9ypRak203IR3UMHLa7zcd8oFKFi+XFDiXvHe3GDY3oEMS2s5
 H34NlRYNHJtUVXrkhTf/J/f60kGB7YP/3nQ/SHNltWw8fQ7wNak0aCm9tunKna1LgF7HFPPm
 hX5m2SZLp4lg5xTAvCIk6TymOHrD0Thn9Z41pifqrB1qD9DGp8x/4gh6s5/+jKuc0ubeQR3c
 rFc/qmnlfa47at5l1eHKmUUMpc4KWwkeauTreNgf3yOBC6JSCfKgBoMWOJa0RWBsnxLi04Vb
 llhSlmXYE3KowrKmg/jwn0Gox8xuDorGvBUtiNUlxD4nvWosgdsSDP5YTjaxubNnC4X5uN9X
 mFDzuCKvYZz+4Y8wmI9meAt4FONPn8dwOSIHezt1c0mM3KojFIbZHdJ5O4R2npnwBdaqQvak
 wSDJfCX/NnDnLtDs1ZA5acursZFj8kjdvI9j9v6eB9NcMLXWCpn2GxG02D/Buw/DJWr7FJZs
 McrT1UlHyiwxZO6UMHZUlu5UuBqo4ImYgpbcggVs1KFG2RrnwxB9ej8VcIjgDQya/Snc+lLW
 soIHPeaHfdfDgDP1hub42i5I0/h2+6Yb
}

This is what I call my "TrapShapePlayground". When you open it, you should see a square image with a light blue background and a circle that is white at the center and black at the edge. When I want to create a complicated trap shape, I use this as my starting point, because it lets me see my trap shape without any distortion from the fractal formula. You can see a screen shot of it opened here:

Trap Shape Playground Screen Shot

...although my screen is pretty big, and this screenshot is about 800K. I used a screenshot so you can see the entire UF interface.

Let's first do a little tour of the interface in UF5 for working with objects in formulas. This is going to be *essential* for you to feel comfortable working with objects, so please bear with me. Go to the Layer Properties panel and look at the Inside tab. (The playground uses inside coloring, but we'll be able to transfer the trap shape anywhere, so don't panic.) You'll see I have "Generic Coloring (Gradient)" loaded. As with UF4, the top set of options above the line are always the same and the bottom options vary with the formula loaded. With UF4 we had parameters that could be numbers, checkboxes, drop-down selections, or colors. With UF5 we have all of those, but we also have a new type of choice: the object. You can recognize a parameter object because it will have a little triangle on the left of the label and an icon on the far right side.

Each object can have its own parameters (even other objects) so UF will group them together by indenting them. You can click the little triangle to hide all the object's parameter and just leave the object name visible. Please do that now. Click the "Coloring Algorithm" parameter (the first one) and notice how it hides everything; that's because the first and only parameter in "Generic Coloring (Gradient)" is the actual coloring algorithm (we'll discuss that another time). Click again to show the parameters. The very next parameter is part of the "Orbit Traps Gradient (UF5)" algorithm, because it's indented and shown inside it. (Notice the faint lines under the triangles that show you where the parameters end.) This next parameter--"Trap Iteration" is also an object parameter, into which "Trap Select" is loaded. Note, though, that these parameters are hidden by default. Click the triangle to reveal them. There is just one, but if you change that one you will see more. Again, a topic for another day, but I wanted you to see that objects can have parameters too, and how to show and hide them. So, hide the parameters for "Trap Iteration" because we won't need them while playing with the playground.

The next parameter is "Trap Position", which defaults to visible. The "Trap Position" object can be used to place traps in ways very similar to how the positioning parameters of "Orbit Traps (UF3)" worked. If you're familiar with this trap formula--as everyone who has taken Janet's courses will be--you will find these options work the same way. For now, I want you to right-click in the "Trap Center" field and choose "Explore". Select any coordinate from the explore window. We can reset this by using "Undo", but I want to show you something else. You may recall that with UF4, you can reset \*all* the parameters for a coloring formula by clicking the blue triangle near the top of the window (under the ? icon) and choosing "Reset Parameters". That resets everything, including all the object selections. If you want to reset the parameters for just one object, right-click the icon on the right edge of the window for that object, and choose "Reset Parameters". Please do this now for the "Trap Position" object, and see how it resets the "Trap Center" to (0,0). Note that if the object you're resetting has any object parameters, those too will be reset. When you reset, what's \*inside* the object gets reset (all of it), but what's *outside* the object will be left alone.

For now, let's collapse the "Trap Position" object (we will come back to it later). The very next parameter is "Trap Shape", and it has "Point" loaded into it. If you look at the triangle next to "Trap Shape" it points down, but there are no parameters that appear under it; the next parameter listed is "Trap Transfer" and that's part of the "Orbit Traps Gradient (UF5)" parameters, not the "Point" shape. (You can tell this is so because "Trap Transfer" is not indented inside "Point".) This visual oddity--looking like the parameters are shown but none appear--is because the "Point" trap shape doesn't actually have any parameters.

Let's load a new trap shape in instead of "Point". I'm sure you're all familiar with this now, after making it through Ron's first challenge. Left-click the icon to the right of "Point" and the browser will appear. Whenever you use the browser to load a new object into a slot, it will only show you objects that will "fit" into the slot. So, choose "Astroid" as the trap shape. Now you will see that any "Trap Shape" parameters will appear under the object name, just as they should.

To summarize so far, we have the "TrapShapePlayground" UPR, where the coloring has this structure:

Generic Coloring (Gradient)
 Coloring Algorithm -> Orbit Traps Gradient (UF5)
   Trap Iteration -> Trap Select
   Trap Position -> Trap Position
   Trap Shape -> Astroid
   Trap Transfer -> Trap Transfer
   Trap Mode -> Closest
   Trap Texture -> Flat Texture
   Trap Color Mode -> Distance

Summaries like this are helpful because they show the "big picture" of how the objects have been fit together. In this list I've given the parameter name on the left and the object name on the right, and used indentation to show which parameters belong to which object. And I've only listed the object parameters.

As I explained in my previous message, these parameters represent the basic building blocks of the orbit trap coloring method. Different challenges will focus on different pieces. Challenge #1 was all about experimenting with the "Trap Shape" parameter to see that we now have hundreds of trap shapes we can plug in. Challenge #2 is all about learning how to use "TrapShape Merge" and "[TrapShape Block]]".

"TrapShape Merge" and "TrapShape Block" are both "TrapShape" objects, in the sense that they fit into the same kind of slot as "Astroid" and "Point" and "Hypercross". But they are examples of a general pattern we call "wrappers", in that they aren't useful by themselves, you have to put something else inside them to make them valuable. You can give someone a gift, but if you wrap it it looks nicer; if you just try to give them wrapping paper without a gift inside, though, they won't like it nearly as much. (Tried that. *ahem*)

We will start with "TrapShape Merge". Click the icon to the right of "Astroid", and use the browser to navigate to the common.ulb file and choose "TrapShape Merge" from it. When it loads, you will see the circle trap shape has returned. Our coloring outline now looks like this:

Generic Coloring (Gradient)
 Coloring Algorithm -> Orbit Traps Gradient (UF5)
   Trap Iteration -> Trap Select
   Trap Position -> Trap Position
   Trap Shape -> TrapShape Merge
     Trap Shape -> TrapShape Block (1)
       Trap Position -> Trap Position
       Trap Shape -> Point (2)
       Trap Transfer -> Null Transfer
     Trap Shape -> TrapShape Block (3)
       Trap Position -> Trap _Position_
       Trap Shape -> Point (4)
       Trap Transfer -> Null Transfer
   Trap Transfer -> Trap Transfer
   Trap Mode -> Closest
   Trap Texture -> Flat Texture
   Trap Color Mode -> Distance

I've marked (1), (2), (3), and (4) for special discussion. Notice that now we have *five* parameters all named "Trap Shape". It's going to be very important for us to keep track of which parameter we're talking about when we say "trap shape".

The purpose of the "TrapShape Merge" wrapper is to let us combine several trap shapes together in any slot that normally accepts just one trap shape. The defaults are to load up with two "TrapShape Block]" wrappers already set up (1 and 3), each with a "Point" trap shape loaded in (2 and 4). The default "Merge Mode" is "minimum" which is fine for now.

Select the icon next to "Point" (2) and choose "Spiral" from dmj5.ulb. You should end up with this:

TrapShapePlayground {
; www.fractalus.com
::mPoU5in21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RkDRQlDRwlDRglDRmSOEBROEBSOEBXOEZM5Q
 EU5QEW5QEY5gj9coDO2jYHU1CL9T18P4SsXypVi9iPfpsHRQo6EeYBHwU2jQIUJfy9VX2Qoy
 XRMgMuHR0fcvMnjDK7RUEIz6hN93/WzEP+m0Ilz5YmyeEIxwClgqodSi+KasDi81txffNcyn
 0UalypfUTZPy2/DmMopDXNsjToSZiYeDOnzToSIbmeiTz8SWz+yii+11gkNprQltSxyWq4UY
 R/XLc2nUU2jILmxZ7k9I0ilvFxp2i+v/2o2izKxOsB4o9Vn1aZrV5Pop0Pg6JGU966GOLN1J
 W7Sr5BQ7RJ3VzkvZXZiaJ2+D4b9eCVtipU/lFfSNg+0rbLg9w47KqOBXf/Ru99yP+L5Vt82x
 W5qLYdnGNU2XfmTpwPnJ2e4skWnI3fg41dZSf74SxJ3F4QqPzdlOr+Tz9RPI2GOlaP3pXe3L
 8fNnNWH5Q0a/K5rFXTS+hAO5kCcjsWNS3SfQdT4OwuP/cpDnSviGe5jitx234OyJ+9rHI8vd
 9r9Hg93lJnlXmM2Bj8+PT3OtjK/JVh5EU6Q1TzglvGuTU1/WuaWU1OxF/RE4C/SBs/nJg74b
 Y7y7mMt/04Xll2iqKZ3uM7ryKT5/O2Xu5hqCEbP8J7v2JgSpuOyhnhf9IOOBlVvW69/2S4Sk
 F9/BGUzyED==
}

Notice that while you can see the center of the spiral, the other trap shape--the "Point" is also visible. Both trap shapes are working. (You can play with the "Merge Mode" if you like, but keep in mind the AND/OR/XOR modes do not work yet. Change back to "minimum" when you're done experimenting.)

We've talked about "TrapShape Merge", but we haven't talked about "TrapShape Block" yet. "TrapShape Merge" loaded up with two "TrapShape Block" objects already selected; what are they for? The answer is primarily about the "Trap Position" and "Trap Transfer" objects.

Locate the "Trap Position" parameter that belongs to "Orbit Traps Gradient (UF5)". (Hint: it's the one listed *above* "TrapShape Merge".) We hid the parameters for this so we could look at the trap shapes, but let's open it again. Change the "Trap Center" to (0,5, 0.5). Notice how this moves *both* trap shapes! That's because this "Trap Position" object is used on the whole "TrapShape Merge" object, which has both trap shapes inside it. So, you use the "outer" "Trap Position" to move the entire group. Change the center back to (0,0) for now and collapse the "Trap Position" parameters so they won't distract us.

Let's look back inside our "TrapShape Merge" and show all the parameters for the spiral trap shape's "Trap Position" object. (Hint: it's the "Trap Position" just above "Spiral".) Change the "Trap Center" in this object to (0.5, 0.5). Notice that this time, only the spiral shape moved. That's because this "Trap Position" object is only used on the "Trap Shape" inside the "Block". In fact, that is the *purpose* of the "TrapShape Block" object: to let you use a "Trap Position" and a "Trap Transfer " object on just one trap shape, not the entire group. In our example, you *could* replace the "TrapShape Block" objects (1 and 3) with ordinary trap shape objects like "Astroid" or "Point"; if you do, though, you won't be able to position the trap shape separately from the group. That is why "TrapShape Merge" loads with "TrapShape Block" objects in its slots.

Now, you can experiment with the playground and come up with interesting trap shape combinations, but when it comes time to use your trap shapes elsewhere, how do you do it? Well, if you right-click an object's icon you will find "Copy" and "Paste" on the menu. So, you can copy the top "Trap Shape" parameter from the playground and paste it into any "Trap Shape" parameter somewhere else; it will copy everything inside it. So if you copy the "TrapShape Merge" and paste it into another fractal's "Trap Shape" slot, you'll get the merge, the blocks, the positions... everything that's inside it. This is very useful.

I hope this introduces you a bit to trap shape merging and trap shape blocks. If there are questions, please ask!

Damien Jones

Personal tools