The Cookbook |
The Cookbook is an area for general tips that don't fit neatly into other categories. None of this stuff is gospel you smarty-pants people can come up with more clever ways to do many of these things. They aren't supported either, unless you are really really really nice and send me lots of gifts, especially items that involve power cords and cool LED readouts. Remember, 220V, French outlets, please.
Good Habits
Use Transform - SetDOD
This node limits the portion of the image the renderer needs to concentrate
on, as well as quickly masks off a large portion of the image. This helps optimize
memory, IO activity, and render times. In this example, even though the only
interesting portion of the image is the ball in the middle, Shake inefficiently
has to consider the entire image.
Limit the area Shake must consider by applying a Transform
- SetDOD node to optimize the render:
For more information, see Overview - About the DOD.
Take Advantage of Concatenation of Color Correctors and Transforms
Several nodes under the Color and Transform tabs
concatenate with nodes of the same class (that is, Color nodes with Color nodes,
Transform with Transform). The nodes compile several connected nodes into one
render pass, preserving quality and decreasing processing time. Nodes that concatenate
are marked with a small C:
To take advantage of this, try not to mask or insert nodes between
these concatenating nodes. In these two examples, the second tree is better
because ContrastLum does not concatenate, but Compress and Brightness
do. Therefore, it is better to plug Brightness into Compress.
Bad Habits
Don't do the following things or poisonous monkeys will be sent to punish you.
Reorder Before Masking
This pops up a lot in client scripts, which is a Reorder on an image
before it is fed into a mask. This is unnecessary, as the mask inputs, SwitchMatte
and KeyMix all have channel selectors. Probably there is no computational
difference, but it's one more node in the tree.
![]() |
![]() |
Masks on Concatenating Nodes
Masking a node breaks concatenation. This is bad. It slows your
render and decreases quality, adds possible ringing on the mask edges, and
forces multiple mask mixes. Instead, feed the tree into a KeyMix:
Bad | Good |
![]() |
![]() |
Same Mask Used Multiple Times
Even if the nodes don't normally concatenate, but are still adjacent, you get cleaner edges with the use of a KeyMix. In this example, a circular mask is applied on three filter effects. Each filter works on the previous node, so problems appear on the edges. The solution is, again, to use KeyMix, giving you a faster render (doesn't mask-mix multiple times) and a clean edge:
Bad | Good |
![]() |
![]() |
![]() |
![]() |
Saving Black-And-White Images As RGB Images
Shake is channel agnostic you can pipe any channel image into any other. When you generate or save mask images, save them as formats that support 1-channel images (rla or iff, for example) to reduce disk space and network activity. You can quickly strip channels out using the command line:
Coloring Tips
Tinting
These five techniques demonstrate the versatility of the color correction nodes. Each one applies a tint to the image, meaning the midtones are pushed towards a certain color while leaving the blacks and whites alone. None of these techniques have any particular superiority over the others they just illustrate several ways of doing the same thing.
Brightness + Mult: These nodes concatenate in the
following node tree. This doesn't work well if you use a pure color in a single
Mult (in this case, pure blue with a value of 0,0,1) because the zeros
drop the midtones out completely on the red and green channels. The Brightness
is set to around 3, helping to maintain the red and green channels when the
blue multiplier brings them back down (.3, .3, .8 in Mult1)
![]() |
![]() |
Monochrome + Brightness + Mult: This is identical, except
you get a purer blue color since you have made it a monochrome image before
applying the color correction. Note the Monochrome does not concatenate
with the Brightness.
![]() |
![]() |
Lookup: This is using a Lookup curve, setting the midpoints of the curve to .3, .32, .8:
![]() |
![]() |
The curve looks like this the curves are Linear to mimic
a Tint function from a different package.
ColorMatch: This is similar in theory to the Lookup,
as it allows you to push the lows, mids and highs. However, the internal math
helps reduce solarization (hills and peeks in the curves), so you maintain
a little bit more of the input color.
![]() |
![]() |
You can get interesting adjustments of your values if you adjust
the source points on the ColorMatch (hold down O and drag left
on the highSource color picker for example).
![]() |
![]() |
ColorCorrect: This is an Add on the Mid
areas using -.2, -2, .5.
![]() |
![]() |
Using Mix: You may end up with several
nodes to achieve a particular color correction. This may be awkward to tune.
Therefore, a convenient way to quickly adjust a result is to mix it back into
the input image with a Layer - Mix node. Naturally, it is always
faster to process by adjusting the original Color nodes, but using
a Mix may be easier for you to keep a handle on things.
![]() |
![]() |
Volumetric Lighting
Script found in doc/cook/scripts/volumetric.shk. This
simple hack gives you fake volumetric lighting by using Filter - RBlur.
One of the key principles is that RBlur is dog-slow, so it is better,
if you can, to apply a radial blur on a low-resolution element and then scale
it up. To get the volume effect, subtract one RBlur from another. You
should also drop your quality down to (to .25 for example) when testing.
In this tree, RBlur3 is generating the main cone of light.
Move2D1 is used to scale it upwards, saving you a little rendering
time. CornerPin2 is used to generate the "shadow" element
and place it on the ground in perspective. RBlur1 is at full resolution
to maintain the crispness of the rays.
Keying Tips
Script found in doc/cook/scripts/clouds.shk. Images are doc/pix/moon.iff and cloud.iff.
This is a potential technique for keying clouds, but may also be useful for flames.
This script puts the moon behind the clouds:
![]() |
![]() |
You might think a color-based key would work, but basically everything is a shade of blue, so that won't do. Go sit in the corner. What were you thinking?
Another attempt is with a LumaKey. In this attempt, the
moon is corrected (using a Compress, an Other - AddShadow
to add the white glow and then positioned with Move2D1) to adjust the
moon's color and position. A key is pulled on the clouds with LumaKey,
and a Layer - Atop to only layer the moon where there is Alpha
in the background. This displays two typical problems with this sort of keying:
There is a black edge, and there isn't complete opacity in the thick part
of the clouds. This is bad:
![]() |
![]() |
In this next attempt, there are three main branches. The first,
identical to the second attempt, manipulates the moon. The second branch,
terminating in KeyMix1, works on the RGB of the clouds. The KeyMix
mixes a darkened cloud image with a brighter cloud image through the RGrad,
giving me the "glow" through the clouds. The third branch works
on the key of the clouds. This is divided into two sub-branches, one which
pulls a soft key on the clouds, and the second which pulls a hard key to act
as a garbage mask:
Move2D1 | KeyMix1 |
![]() |
![]() |
A luminance key is used here. The blue channel has less contrast
than the red channel. Therefore first insert a Color - Monochrome,
and boost the rWeight up and the g- and bWeight down
before you key.
red channel | blue channel |
![]() |
![]() |
A Color - LookupHLS manipulates the luminance,
and then switches that into the Alpha with Color - Reorder (a
macro begging to happen) to key the deep part of the clouds in the lower-right
corner. The curve looks like this:
The LumaKey get the edges of the cloud, which is enhanced
by a DilateErode, and the fed to be subtracted from the soft key.
DilateErode3 | LumaKey1 |
![]() |
![]() |
You still get black edges, so sprinkle Filter - DilateErode nodes liberally. For the those attached to ISub1, the first chews into the edge, and the second DilateErode softens it by turning soften on.
As a final touch, the x/yCenter of the RGrad is linked to the Move2D x/yPan, adding an offset for the center of the moon, Move2D1.xPan+155, Move2D1.yPan+160. You can modify the position of the moon and the glow on the clouds follow.
Vignette
Script found in doc/cook/scripts/vignette.shk.
![]() |
![]() |
This tree involves a lot of masking. Remember, Roto is your
friend. Not a very fun friend. Actually, a more accurate description would
be "Roto is a painful experience up there with bone-marrow transplants,
but as equally vital in some situations".
The first section, down to KeyMix1, pulls a key on the sky. The first Keylight pulls a hard key to be fed into the the second Keylight. This is the core key for the bridge. This is keymixed with a Primatte-based key for the blue area through RotoShape1.
Once the key is pulled, it is Monochromed and composited over a Ramp. This is then tinted with ColorMatch. A good trick is to drag the Color Pickers while holding T down - this is for temperature and can be used to warm up or cool down a color.
The image is then defocused with a mask. This result is masked
by the node Inside1 with a square mask (Blur2) to get the black
frame.
Add1 | Blur2 |
![]() |
![]() |
Layering Tips
Bleeding Background Color into the Foreground
Script found in doc/cook/scripts/edgelight.shk
This script, which has its effect rather exaggerated for illustration
purposes, helps blend in some of the background color onto the foreground
material. Note this is one variation there are several ways to do this.
Normal Composite | With Exaggerate Rim Lighting |
![]() |
![]() |
Emboss1 | IMult1 |
![]() |
![]() |
Background Flare
Script found in doc/cook/scripts/backlight2.shk
![]() |
![]() |
This script translates D.W. Kim's fine backlighting page from highend3d.com into Shake terms. It uses the Vanilla image from the Shake tutorials. There are other ways to do this.
It starts with a Color - Reorder to put the
Alpha into the rgb channels. It then Filter - Blurs it, inverts
that, removes the Alpha channel with a Color - SetAlpha set
to 0, and then is added back onto the plate. The Color - MDiv
is used because the IAdd disrupts the premultiplication status. The
Color - Gamma can be used to tune the intensity of the flare.
Finally, preMultiply is activated in the Layer - Over.
Toilet Bowl
This animates something in a spiral pattern, running ever
smaller (or larger) concentric rings. You first have to create a local variable
called mul by pressing the Right mouse in the Parameters
area.
![]() |
![]() |
You control the speed towards the center and direction by animating the mul value. To slow down the degrees in each frame, multiply time by a second localParameter, for example freq:
sin(time*freq)*mul
If you animate freq from near 0 to 1, it looks something
like this:
The path does not show up by default, as there are no curves. To burn the path in, perform the following steps:
Set timeRange under Globals (1-50, for example),
Press the Right mouse over the xPan expression and select Save Expression.
In the lower-right corner of the Browser is a setting for either Auto or Raw. Set it to Raw.
Enter a name for your curve, for example, curveX.txt
Do the same thing for yPan, saving it as curveY.txt.
Create a second Pan node.
Press the Right mouse and select Load Expression on the xPan parameter.,
Set your format in the Browser as Raw.
Not elegant, but it works.
Auto Orient
Script found under doc/cook/scripts/autoorient.shk.
![]() |
![]() |
This script demonstrates how to set up a transform so that an element automatically rotates according to the tangent of the move. Although you can perform this with one node, it is better to use two so that you can continue to modify the position without destroying the expression to do the rotation. If you want to animate or modify the rotation, insert a second Rotate node the transforms concatenate.
The rotation is determined by obtaining the position just before and just after the current node by using the @@ notation: (xPan@@time-.5) returns the xPan position half a frame earlier. These coordinates are then fed into the atan2d function which returns the angle between two points.
Depth Tips
Fog
Image found under doc/pix/uboat.iff. The background is
just a Ramp. The trick is to apply depth-cueing to the uboat:
![]() |
![]() |
My first composite, without any fog, is not so stellar:
![]() |
![]() |
The second approach is to use Key - DepthKey (distance
of 45) to pull a transparency key. Not so good, as you get artifacts along
the edges:
![]() |
![]() |
This more complex approach uses the DepthKey as a mask
for a color correction, in this case, Compress, which has identical
hi and lo colors.A KeyMix is used to get the concatenation
with Mult and Compress. The Mult is used to tint the
boat green, Compress gives the feeling of depth:
![]() |
![]() |
Car Ads
These are a series of scripts playing with Text treatments, stored as doc/cook/scripts/car_ad_text.shk, numbers 1 through 8. If skillfully blended into a car ad, these renders lead people to believe that the purchase of a luxury SUV getting the gas economy of a Sherman tank and designed for the rugged and wild paved city streets is a really good way to dispose of $42,000.
Script 1:
![]() |
![]() |
Script 2:
![]() |
![]() |
This script depends on Ramp2D, a macro stored in doc/cook/macros. It creates an animated mask traveling across the text, driving both a IDilateErode and an IBlur. The IDilateErode has a value of -4 for X and Y. The Solarize is used to boost up middle of the Ramp2D and to drop the outer ends to black. Like script 1, you only set the yPixel blur in IBlur1:
The Ramp2D:
Script 3:
![]() |
![]() |
This uses the noise() function to randomize the xCenter of the RGrads. The text is then held Inside of these two animated shapes, and a process similar to Script 1 is applied:
RGrad1's xCenter expression: noise(time/4)*Text1.width
RGrad2's xCenter expression: noise(time/4+100)*Text1.width
By adding 100 to the noise function's seed, you don't have an overlap in the animation. You can also change time/4 to increase or decrease the frequency, that is, time/10 or time/2. See Expressions, below.
Script 4:
![]() |
![]() |
This uses a heavily motion blurred CameraShake (frequency is set to 6, amplitude is set to 50 and 100 for x and y). This then drives an expanding IDilateErode and IBlur to create an interesting interaction with the text that will somehow convince people to buy more cars.
Script 5:
![]() |
![]() |
The same CameraShake from Script 4 is used to feed an IDisplace. The Blur helps to soften the warping image.
Script 6:
![]() |
![]() |
The same as Script 5, except the Screen is replaced with the Relief macro, found in doc/cook/macros. The script does not open without the Relief macro. The affect of Relief is set to image 2.
Script 7:
![]() |
![]() |
Same as script 6, but the result is fed back over the motion-blurred text.
Script 8:
![]() |
![]() |
This script is driven off of the position of the RGrad. The RBlur's center is set to the RGrad's center, and the right parameter of SetDOD1 is set to RGrad1.xCenter+10, which therefore unmasks the text as the RGrad moves to the right.
Expressions
For more information on Expressions, jump to Functions By Class - Expressions. See also the Advanced - Fan Tutorial for a guide to adding local parameters to help with your expressions.
Signal Generators. These functions all generate a value
that changes over time. Typically, you feed the variable time to modify
the value:
cos(time) | sin(time) |
![]() |
![]() |
noise(time) | lnoise(time) |
![]() |
![]() |
fnoise(time,1) | turbulence(time,1) |
![]() |
![]() |
fnoise() and turbulence() have additional frequency
factors to the noise:
fnoise(time,2) | fnoise(time,5) |
![]() |
![]() |
turbulence(time,2) | turbulence(time,5) |
![]() |
![]() |
To offset a function, add a value to time.
cos(time) | cos(time+10) |
![]() |
![]() |
To change the frequency of a function, multiply or divide
time by a value. fnoise() and turbulence() both have
frequency controls, but values are not modified below 1, so you may still
have to modify time:
cos(time) | cos(time/3) |
![]() |
![]() |
noise(time) | noise(time/2) |
![]() |
![]() |
The noise generators noise, lnoise, fnoise
and turbulence are continuous noise generators, meaning you can draw
a continuous smooth curve between the values. For example, noise(1)
= .554 and noise(1.1) = .5182. You can usually safely predict that
noise(1.05) is near and probably between these two values. Thankfully,
I'm not a rotten disreputable liar, since it equals .5358. However, if you
use the rnd() function, you arrive at discontinuous noise. For example,
rnd(1) = .4612. rnd(1.1) = .4536. You might guess that rnd(1.05)
is between those, but it in fact equals .0174, not .458. Go figure. This
is why it is called discontinuous noise. Looking at the neighboring values
does not help you to arrive at a safe guess for the between values. For
this reason, frequency changes have no practical effects on the curve:
rnd(time) |
![]() |
The noise generators return values between 0 and 1. sin()
and cos() return values between -1 and 1. To adjust the range, use
addition and multiplication. For example, suppose you want to spit out values
between 100 and 400. To make a noise generator do that, subtract the low
value from the high value. This is your multiplier. Then add the lower value
of your range. Thus, you have: noise(time)*300+100. As cos and sin
return values between -1 and 1, you have to offset the output by
1 and multiply by half of the difference between the two: (sin(time)+1)*150+100.
noise(time) | noise(time)*300+100 |
![]() |
![]() |
You can use other functions like ceil(), floor()
or round() to help you break a curve into steps. In this example,
to break a noise function into 5 steps between 0 and 1, multiply the value
by 6 (float values of 0 to 6), knock off the decimal places with a floor()
function (returning values of 0,1,2,3,4,5) and then divide by 5, returning
values of 0, .2, .4, .6, .8 and 1:
noise(time) | floor(noise(time)*6)/5 |
![]() |
![]() |
Another helpful expression is modulus, written as a%b. This
divides a by b and returns only the remainder. This is helpful
to fit an infinite range of values into repeating limit. For example, here
is time%10:
A good application of modulus is if you have an angle of any potential amount (for example, 4599) but you need to fit it into a range of 0 to 360. You would use angle%360, which equals 279.
Command line Macros
FrameFill Macro
Macro found in doc/cookbook/macros. This is used in an emergency to fill in a missing frame when you have to go to film in, say, two minutes. It takes the frames next to the missing frame and averages them together. Don't tell anybody you are using this, you will get fired.
shake -framefill bus2.#.jpg -t 41, 45
vanilla, frame 1 | vanilla, frame 3 |
![]() |
![]() |
vanilla, normal frame 2 | framefill frame 2 |
![]() |
![]() |
UnPin Macro
Macro found in doc/cook/macros. This is used to extract a texture map from an image. List out the four corner points (lower-left first, counterclockwise). You can also set the antialiasing. This is a macro of the CornerPin node with inverseTransform activated. You usually use two Terminals to do this, one to test your coordinates, the second to test the command. You can get the coordinates by scrubbing on the image the coordinates appear in the title bar.
In the doc/pix/bus directory:
shake bus2.0040.jpg -unpin 91 170 417 154 418 242 94 274
![]() |
![]() |
Image
Macros
Flock Macro
Macro found in doc/cook/macros. Bird clip
found in doc/cook/macros/bird.tar. This takes a cycling clip and propagates
copies of it offset in time, position and scaling. There is a clip of birds
provided as an example that you can use, royalty free. If you use it, let us
know.
![]() |
![]() |
You can use the box to roughly position the birds. The birds are also positioned with two extra movements, a gentle cosine function and some random noise. The freqX and Y controls the frequency of the cosine movement (an up and down wave), and vibrationX and Y and vibFreqX and Y control the random movement.
Manga Macro
Macro found in doc/cook/macros. This
is another example of using NGLRender.
![]() |
![]() |
The second image has a Twirl applied with a very low antiAliasing value.
For more information (kudos to Tom Tsuchiya, VPJ) on Concentration Lines ("Syuuchyuu-sen "), jump to
and
Rain Macro
Macro found in doc/cookbook. This
macro can be used to generate rain to throw into a background. The rain is
divided into three sheets, fg, mid, and bg. The lighting controls effect
the height of the sheets. By using a low value, you can get a fake feeling
of depth. Sort of.
Ramp2D Macro
Macro found in doc/cook/macros. This uses the NGLRender drawing routines to draw a polygon on the screen to give you a ramp between any two points. See www.highend2d.com for more examples of the NGLRender commands. Check out Arc and Concentric. The wedgeSize parameter should be brought down if you start to see artifacts along the edges.
RandomLetter Macro
Macro found in doc/cook/macros. This generates a
random letter up until the staticFrame number, at which point it becomes
a letter of your choosing.
Frame 5 | Frame 6 |
![]() |
![]() |
Slate Macro
Macro found in doc/cook/macros. This
generates a slate giving information on the show, animator, frame range, and
so on. Although you can use it to generate a frame, typically you attach it
to the end of your script before the FileOut. If you create the FileOut
first, you can link the Slate to print the FileOut file. You
must precede it with a : , for example, :MyFileOut.imageName.
The slate appears up to the markFrame parameter, which is 0 by
default. It also loads the script name and the frame range into the slate,
adds the current date, and gives you the option to stamp the current frame
onto the output images.
![]() |
![]() |
Color Macros
AEPreMult Macro
Macro found in doc/cookbook. This
macro is intended to be used on an image that has a solid non-black background
color that is still considered "premultiplied". By applying this
function, you turn the background color to black. This may be a little iffy,
so if it doesn't work out, let me know...
![]() |
![]() |
ColorGrade Macro
Macro found in doc/cook/macros. This macro allows you to pick three color levels from a source image (typically shadows, midtones, highlights) and match them to a target image. This is similar to ColorMatch, except it doesn't have the special math to protect it from solarizing. As a consequence, it is more accurate.
In this example by Richard Liukis for his
short film "Taste It All", the plates were scanned with an unfortunate
strong green cast. The shots were telecined down to video, color corrected
with DaVinci and edited. This same color correction needed to be applied
to the film plates, so the video version and the logarithmic plates were
both read in to Shake. A Color - LogLin was applied to the
2k plates, and then a ColorGrade. You can see the green is even more
pronounced in the default LogLin. The ColorGrade was used
to match to the telecined version and then a second LogLin was applied
to return it to log space.
Input Log 2k Plate | Linearized 2k Plate |
![]() |
![]() |
Telecined Reference Footage | ColorGraded plate |
![]() |
![]() |
This example has a slightly high saturation, a slight blue cast, and punchier whites, but then again, 30 seconds were spent on it. Note because the tree is made of three concatenating color corrections, it was not necessary to convert up to float bit depth before the LogLin:
Deflicker Macro
Macro found in doc/cook/macros. This macro is helpful for reducing the flicker on an image. It takes two inputs. The first input is your reference frame, which should be a single frame from the clip you want to affect. The second input is the sequence you want to remove flickering from. To use the macro, place the crop box on an area that is representative of an area that doesn't change its content, that is, over a portion of sky, rather than on the moving traffic below.
The first frame is usually a still reference
frame. The second input is the flickering sequence. Because of some stoopid
bug, the onscreen controls go haywire, so position the box while looking
at Input1 (SingleFrame in this example).
![]() |
![]() |
Temp Macro
Macro found in doc/cook/macros.
This macro slides the midtones to warmer or cooler colors. Color-temperature-cool,
not Fonzie-cool.
Original | Warmer | Cooler |
![]() |
![]() |
![]() |
Filter Macros
Relief Macro
Macro found in doc/cook/macros. Example one has affect
set to image1, the other two are set to image2:
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Key Macros
AlphaClamp Macro
Macro found in doc/cook/macros. This macro clamps the Alpha channel to 0 and 1. This is helpful for float images and when pulling LumaKeys, as you can arrive at negative values that seriously mess with your RGB channels. This macro is unnecessary for 8 or 16-bit images.
KeyChew Macro
Macro found in doc/cook/macros. This is intended to give a more natural chewing or expansion of the matte edge than the one you get from DilateErode. This macro works only on the Alpha channel. It also destroys any mid-range alpha areas (reflections and shadows).
Note: This clamps your Alpha channel to between 0 and 1, so be careful with float images. It maintains your float RGB channels properly.
Chewing In, DilateErode | Chewing In, KeyChew |
![]() |
![]() |
Expanding Out, DilateErode | Expanding Out, KeyChew |
![]() |
![]() |
Transform Macros
AutoFit Macro
Macro found in doc/cook/macros. This macro resizes an element if you only know one dimension of the output and you have to figure out the second one. You can use it in the command line. The second parameter determines what the first parameter specifies (Note: this is the opposite of previous versions). You can provide either w or h or 0 (width) or 1 (height)
shake woman.sgi -autofit 2048 w
This resizes doc/pix/woman.sgi to 2048x1383, thereby keeping it the same aspect ratio.
PreTrack Macro
Macro found in doc/cook/macros. This macro helps when
tracking noisy film plates. It drops the blue channel out, which tends to
have the thickest grain, and also applies a slight blur to the footage.
Once the track has been done, disable or remove the PreTrack node.
![]() |
![]() |
RotateFit Macro
Macro found in doc/cook/macros. This resizes the frame
to fit the new boundaries of the image. This version uses math to figure
out the boundary, but you could also put the variables dod[0] - dod[3]
into a Crop node:
Warp Macros
SpeedBump Macro
Macro found in doc/cook/macros.
![]() |
![]() |
Other Macros
Candy Macro
Macro found in doc/cook/macros. The drop shadow only appears on the background image's Alpha plane. It just seemed like a good idea at the time. If you don't like that, turn off shadow generation with the useShadow parameter and use the normal Other - AddShadow or DropShadow commands. Both the Foundry and Gen Arts have similar functions, and they are much faster than this.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
MakeNodeIcon Macro
Macro found in doc/cook/macros. This is the macro used to make the
icons for the function tabs. Typically, you insert an image that is 700x300
pixels and the macro fits everything inside. Have fun.
AltIcon Macro
Macro found in doc/cook/macros. This is the macro used to make
the alternative icons (see Customization
- Function Tabs. You insert a roughly 250x250 image into it. It
requires the Relief macro to be installed. It also calls on the
font "Arial". If you don't have this font, search for the
word and substitute an appropriate one.
VLUTButton Macro
Macro found in doc/cook/macros. This is the macro used to make the VLUT buttons go ahead, roll your own! It requires (get ready...) Relief, ViewerButton, WallPaper, and RoundButton to all be installed. None of these need the ui files, just the startup files. Additionally, Roundbutton makes a call to the round_button.iff file, also included in the cookbook/macros directory. Place the image somewhere and point the macro file to that new location inside of the Roundbutton macro.
Finally, it calls on the font "Arial". If you don't have this font, search for the word and substitute an appropriate one.
The default arguments are:
text = "vlut {time}"
and
focus = 0 (off)
RadioButton Macro
![]() |
![]() |
image RadioButton( const char *text="linear", // lengths are 74, 37, 53 int length = 74, string fileName=text, string filePath="$HOME/nreal/icons/ux/radio/", int branch=time,
...
Make sure that directory exists. The standard image lengths are 37, 53 and 74 pixels long. The shortest you can practically do is 19.
Finally, it calls on the font "Arial". If you don't have this font, search for the word and substitute an appropriate one.
The parameters are:
So, an example:
shake -radiob "Not A Dufus" 53 NotADufus -t 1-4 -v
This creates four files, NotADufus.on.nri, NotADufus.on.focus.nri, NotADufus.off.nri and NotADufus.off.focus.nri, all of which are 53 pixels wide and say Not A Dufus with different states of being illuminated and focused.
The ui code to plug them in is specified under Customization - Parameter Settings - Radio Buttons
Wallpaper Macro
![]() |
![]() |
This helps with button icons, but it is also an interesting way of quickly generating animated backgrounds. It takes one vertical line from the input image and copies it across the image. By animating the line, you get a continuous-noise generation of sorts...
Wedge Macro
Macro found in doc/cook/macros. This command helps pull an exposure wedge on logarithmic files. You pick an initial exposure setting, and then how far you want the wedging bracket to step (22 points, 45 points, 90 points, and so on). It then goes through 48 steps of color, brightness and contrast. You can do this on the command line:
shake mycineonframe.cin -wedge -t 1-48 -fo mywedge.#.cin
or
shake mycineonframe.cin -wedge -10 15 -9 -t 1-48 -fo mywedge.#.cin
For more information on wedging, see Overview - About Logarithmic Color.
![]() |
![]() |
Using Environment
Variables For Projects
You can set up projects using environment variables to better manage your different shots. This points Shake to the right directories regardless is you move your project to different drives or machines without too much difficulty. What is an environment variable? It is a word that is known by the computer to have a certain value. For example, the environment variable $HOME (environment variables are recognized by the $ in front of the word) is /Users/mylogin in MacOSX. For Linux and IRIX it is typically /usr/people/mylogin. In MacOSX, IRIX, and Linux, you have variables such as $TEMP and $TMP to point to directories where temporary files are stored. Software can simply be coded to dump temporary data into $TEMP, rather than have to find a specific directory.
You can use these in Shake by setting a variable for your project and its directory location. For example, you have a project on //MyMachine/BigDrive/MonsterFilm/Shot8. If you set a variable, for example, $myproj, to point to that directory, Shake can always open to that directory. If you later move the project to //MyBackUpMachine/OtherBigDrive/MonsterFilm/Shot8, you don't have to go into each Shake script and change your FileIn/Out paths just change the environment variable before you run Shake.
To set an environment variable for the Finder in MacOSX, jump to Customize - Environment Variables.
To set an environment variable in the Terminal, open either your .tcshrc, your .aliases, or another file that gets read when you open a shell. Enter a line something like this:
setenv myproj /Documents/shot1
Once you have saved the file, type
source .tcshrc
and you have now set your environment variable. All shell windows that you have already created, and any open applications must be relaunched to read the new variable. For variables you've set using the environment.plist file, you have to log out and back in again.
There is a simple way to test if your environment variable exists. In a Terminal, type echo $myproj and it should return the proper value. |
Now for the Shake part.
nuiFileBrowserAddFavorite("$myproj");
gui.fileBrowser.lastImageDir= "$myproj/" ;
gui.fileBrowser.lastScriptDir= "$myproj/" ;
Create a directory that $myproj points to, that is, if you set it to /Documents/shot1 then create /Documents/shot1.
When you relaunch Shake, it should launch to where $myproj is. If you pull down the Directories menu, you also see $myproj listed.
When you read an image from here, Shake keeps the environment variable ($myproj) in the path. Therefore, whenever you move the entire project, reset the environment variable to point to the new path.
If you batch-render your project, the background machines must also understand the environment variable.
You can take further advantage of environment variables and projects by adding your own startup directory into the project area. Specify a shot-specific cache directory, assuming you have disk space to burn, and, golly, with drive prices so low, who doesn't? This is only useful if you are working on several shots at once, as it keeps cached files around on a per-shot basis. Be extremely careful with this, however, because you can end up with Gigs of data that you don't need if you don't clean up after yourself. Kind of like real life.
To set per-project settings for Shake:
As an example, in your project directory, create startup/ui directories,
that is,
/usr/shot1/startup/ui
In your startup directory, place a file to relocate your cache.
Create a text file called cache.h and add these lines, obviously
changing MyShotName:
diskCache.cacheLocation="/var/tmp/Shake/MyShotName";
diskCache.cacheSize = 500;
The second line indicates the size in MB of your cache. Set it to something
appropriate according to how much disk space you have to spare. Shake automatically
creates that directory the first time it needs it. Don't forget to remove
this cache directory when cleaning up your project.
To have per-shot macros or settings like Formats, add them into the startup and ui directories. See the 769 tutorials and pages on this process under Customization, Scripts and Advanced Tutorials.