The Color Widget
A Digit Widget Zscript
Updated 08.26.01

This widget can control in Real-Time the color section for
a tool or a brush. The main controls allow the user to select a color gradient
in which color is selected in 3D by XYZ coordinates of the tool that is selected.
The real power of the script comes to play when used in conjunction with other
widgets such as, the Interpolation, Angle, Stroke, and Stroke Object scripts.
Gradient color based upon a combination or all XYZ data will color the object.
In addition a Stroke widget is available that will use the
gradient to color a recorded brush stroke. Using this same technology the Color
Widget will also allow the artist to sample a texture or the canvas and pick
out up to 255 unique colors from the source and apply them via a brush stroke.
Hopefully the following will make all this clear. If that is not enough the
widget will also shift RGB colors via 3D and MouseDraw an area of the canvas.
Description of the Color Gradient Controls
- Start Color - This is the starting color of the gradient. Select
a color from the color palette and press the button to store it.
- Ending Color - This is the Ending color of the gradient. Select a
color from the color palette and press the button to store it Note: The
secret of getting a good gradient is the choice of these two color. Experimentation
of getting a good linear span between them is essential. Choosing the wrong
colors can cause unexpected bands of unrelated or unwanted color.
- Color Step - The number of points to take between the Starting
and Ending colors. When the colors are selected this value is automatically
calculated using the Largest delta between RGB values of the color. This will
give you the best resolution possible. To increase or decrease the distance
between increments enter a smaller or larger number in this box. For example:
a value of 10 will give you 10 increments between Starting and Ending, whereas
a value of 100 will give you 100 increments. (See ColorDepth)
- ColorDepth - Essentially a 3D radius of the full range of the gradient.
Example: With ColorDepth set to 500 and Color Step set
to 100 the gradient will take 100 increments to get to an X Y or Z value of
500. Think of it as a box for your gradient.
- XYZColorCenter - This is the coordinates of the Center of your Box
or ColorDepth, the Point of Origin of the Gradient. Changing
this value will effect where the gradient radiates out from. Changing ColorDepth
will control how big the gradient is and Color Step will control the
resolution of it. TIP Manually enter these values or select a tool,
place it in Move and position it in XYZ space and press SetCenter
to automatically set the XYZColorCenter.
- C-X, C-Y, and C-Z - Set these switches to the Axis that you want
the gradient to be controlled by. If you select more than one the values calculated
will be summed and the result will color the object. Example: the Default
setting is C-Z, with C-X and C-Y off the color only changes
when the object or brush stroke changes in the Z-Axis. Setting C-X
on C-Y on C-Z off color is ignored for Z and calculated for
changes in X and Y.
- 3DColor - Use the current settings of C-XYZ to color
the currently selected object. Example: Draw a Sphere, hit "W"
for Move and press 3DColor. It will color the sphere with the correct
color from the gradient based upon it's XYZ position. Move the sphere around
the canvas and change it's color with 3DColor.
- ColorPick - Use the mouse to click on the canvas to read a pixol.
This changes the current color to the correct gradient based upon the Pixol
clicked on. Example: To rapidly choose a color for the area that you
wish to brush press ColorPick and then use the mouse to click on the
area of the canvas. The current color will then change to the correct gradient
color and you can brush upon that spot.
- ColorRandom - Just selects a random color out of the gradient
- Incr Color +/ - - Just increments up and down the gradient one increment.
I may remove this because ColorPick is much more better for this.
- L, R and S buttons - L or Load R for Recall and S
for Save, use these buttons to save and recall your favorite colors on the
fly. Pressing L will cause a little popup to display showing the saved
color for that slot.
Discription of the Color Stroke Controls
- Use Samples - Use the Sampled colors gathered
from the "Get Samples" button
- Use Zcolor - Index the color gradient selected
from the Start and End colors based on XYZ position
- Use ShiftColor - Shift the Starting color based
on Postion and XYZ data X=R Y=G Z=B
- ShiftAxis - Change the RGB order X=R Y=G Z=B. X=G Y=B Z=R. X=B
Y=R Z=G
- SResolution - Controls the resolution of the
Replayed stroke data. Setting this to zero replays the original stroke one
to one. setting it to 1 causes it to skip every other data point. TIP:
Since the recorded data resolution is much smaller than the current draw size
(unless you are using a draw size of 1) the stroke will overlap the last stroke.
Setting this larger will have impact on the color separation between points.
Use it also at larger values to add those finishing touches of color.
- GetBStroke - Get the last Drawn Stroke Example:
Draw a brush stroke on the canvas, maybeperhaps the smile on your Mono Lisa,
doesn't matter what color or Zintensity etc.... Then press GetBStroke,
the stroke data is now saved and you can press Cntrl Z to erase
your last stroke, unless you want to brush over it again. (now see DoBStrokeColor)
- DoBStrokeColor - Replay the recorded
stroke either using the current Gradient or Sampled color dependant on the
Use Samples switch. Tip: Prior to pressing this you may
change any variables that you wish such as the ColorCenter, draw size, zintensity
etc.. I usually use this with Zadd off and maybe just RGB on
since I want only color, but set it up for the situation. If I don't like
what I see, I can change the gradient, or change the ColorDepth
or Center etc and just replay the stroke again. If I am using ZAdd
and I want to erase what I last did, I change it to ZSub and replay
the stroke again to remove the last stroke. Perty neat!
- GetSamples - Use the mouse to sample a portion of the canvas and
extract up to 255 unique colors to use in the DoBStrokeColor if the
Use Samples switch is ON. Example: I want to create a
realistic skin texture, so what better way to do it is to sample some real
skin. I create a new layer, import a skin texture, select Flat Color
and press Cntrl F to fill the empty layer with the texture. I select
a small area of the canvas, say about 50X50, doesn't really matter as the
function will stop after finding 255 unique colors. I press GetSamples and
drag the mouse on the area of the canvas from left to right downwards and
let go. You will see a message, "Working" and then it will
count off the number of unique colors as it is searching thru the area.
- PixolPaint - Use the mouse to block of an area and it will be colored
according to settings based upon the current DrawSize. In other words if you
have a draw size of 10 and you block off an area of 100X100 there will be
10 rows of 10. This can be used effectively with Stencils to achieve colored
areas that are not squared.
A Couple of Examples
I used the Gradient DoBStrokeColor to do this Atom Art's Alien Girl head.
- I set a Dark Purple Start Color and a light purple end color (she is alien
after all)
- Set the Center to about her nose
- Set ColorDepth to 200 (always make it bigger than you think you need)
- Set C-X on and C-Y on (thou since it is a 3D object I could use C-Z for
good effect)
- Using a fairly large brush I did the head by
- using the single layer brush I brushed around
- Press GetBStroke to grab it
- Cntrl Z to erase that stroke
- Made sure that Use Samples was OFF
- Pressed DoBStrokeColor and watched my stroke being replayed but
now using gradient colors based upon the XY position of my original stroke,
Wheee!!!
- I changed Z intensities, draw size, and SResolution
around a bit as I progressed filling in the face area. Sometimes if a
spot was missed and I didn't feel like capturing again I just used the
ColorPick button and clicked on the area, which changed the color
accordingly and I touched up the spot. If I wanted to get fancy I guess
I could have used some different alpha brushes to add some texture to
it, but then again I am a horrible painter :)
- To do the hair, I selected a new Start and End color which
changed the gradient. I used a 3DSphere to move it up to her forehead
and pressed Set-Center to make a new origin, once I did that with
the sphere I cntrl Z'd it.
- Since it is a much smaller area to work in I reduced the ColorDepth
to about 100 and I repeated the process I did on the face using the Widget
controls. Come to think of it, that is also what I did on the bottom section
as well.
Now, I don't know exactly how many subtle changes per square mm I achieved
by using my widget, but I do know that my fingers would be awfully sore and
painful if I had to recreate this admittably bad skin problem this alien woman
has. I am all for the computer doing these tedious and repetative tasks and
with Zscripts the wonders will never cease.
In one of Southern's tutorials he mentions the subtle changes in color and
material that he does in making skin textures for his creations. I am hoping
that this will be the start of automating with control these kind of tasks.
Materials is next on my agenda to make this script even better. I am hoping
that you real artist types out there will find a use for these kinds of scripts
and remember to send me a birthday card every year!

This Head here I did using the same techniques in the above example
except I first sampled a Skin Texture using the GetSamples button and
using a mouse to sample a small area of it. I then made sure that I selected
Use Samples and repeated the steps above to paint the skin. The Lips
I used a Gradient Red Stroke procedure.
More Examples

(had to try a bit of Aurick's tutorial hence the grass)
The main part of the image was made with a one colored Spherical Blend material.
Due to it's material properties there are many shades of color within it. I
sampled a small part of the material and found that it stopped at 255 separate
unique colors! All from one material.
Then using varying intensities, draw size and Sresolution I brushed over the
image. Then with Use Samples on I replayed the strokes adding much complexity
and color to the original image. BTW all done with only MRGB on, because I didn't
want to add any new material only color and the original material properties
of the color. I then used a touch of highlighter brush just using a high Sresolution
to dapple some intensity here and there.
I wanted to see how it worked with other materials so I imported Aurick's superdooper
rock tool and material and placed them around on a different layer. Using the
same sampled colors from the image I brushed over them, changing the bluish
rock to a sandstony rock of multi hues.
Simple example but hopefully it demonstrates a bit what you can do with it.
Southern's Grumpy Elf


I sampled one of Southern's ape textures to get greens and browns
to create the skin texture
Can't compare to his of course but I think it is the best job I have done so
far with a dang head
I took another approach with this one as I painted a base coat on the head
in transform mode and then unwrapped the texture. I then worked on the texture
itself with my widget and then re-applied it to the head. This way I have a
completely textured head to use. If you would like the texture here it be GrumpyElf
Head Texture
PixoDraw Example

Using PixolDraw and some Stencils as well as plan ole square areas I
colored in some reflections off this eye.
I press PixolDraw and used the mouse to drag from corner to corner the area
that I wanted to color. The area was then colored using Samples, Zcolor or Shiftcolor
settings and based upon the current draw size of the brush. In this picture
the draw size was set to 1 for the finest coloring detail.
If you have any problems using this script or have any questions
give me a hoot and a holler over at ZBCentral
The Functionality of this script will be including in the next
version of Digit's Widgets
Remember, I will be expecting those Cards :)