Thursday, March 24, 2011

Journal Post 8

Today I wrote a photoshop script that creates a simple effect. Well, I didn't exactly "write" it, I copied code from the ScriptingListener log and used that to make my own script. I decided to post about it because this script would have been useful for part 5 of the last assignment. For that part of the assignment I applied this same design. If I had the script I could have replaced three of my steps with one.

The code is pretty long (77 lines), so I probably wont post it here. I wish blogger would let me upload a text file or something.



Wednesday, March 23, 2011

Journal Post 7

When looking for Photoshop scripting tutorials I came across this one that I really liked. I learned about these things called Actions which are really handy. I use Photoshop a lot but I've never known about them. They let you record any actions you do within Photoshop so you can execute those same set of actions again with one click. It actually sounds really similar to writing a script, except without having to write code. I can think of many cases where Actions would come in handy.

The tutorial also talks a bit about scripting, but not in too much detail. He demonstrated a script he made that lets him easily rename layers. It may not seem like a bid deal, since it's not that hard to rename layers in the first place, but it does look very useful. First of all, he assigned a hotkey to the script, which is convenient. He also set up the script so there are preset names assigned to specific letters/numbers. For example, when he types in "2" for the name, it automatically names the layer "shadow". A script like this would be nice to have because in some projects I do I'm constantly renaming layers to things like "shadow" or "highlight".

Productivity tips in Photoshop from ShiningCameraVideo on Vimeo.

Friday, March 4, 2011

Assignment 3 (finished)

(Parts 1 and 2 are in the previous post)

3 and 4. Here's the code for the linear and non-linear transitions from complimentary colors. In the image the linear transition strips are the bottom three and the non-linear are the top three.

//linear transitions:
//I switched around the RGB values in setAttr in order to get the different colored strips
float $x = 1;
for ($i = 1; $i < 21; $i++) {
$ball = `shadingNode -asShader lambert`;
$color = $ball + ".color";
$objname = `polySphere -ch on -o on -r .5`;
setAttr $color -type double3 ($i/20.0) ($x) ($x);

xform -translation $i 0 0;

hyperShade -assign $ball;

$x = $x - .05;
}


//non-linear transition:
float $x = 1.0;
float $y = 21.0;
float $w = 5.0;

for ($i = 1; $i < 22; $i++) {
$ball = `shadingNode -asShader lambert`;
$color = $ball + ".color";
$objname = `polySphere -ch on -o on -r .5`;
setAttr $color -type double3 ($x) (5.0/$w) ($i/$y);

xform -translation $i 0 0;

hyperShade -assign $ball;

$x = $x - (1/$y);
$w = $w + (1);
};


5. Here's the image I made. I don't think it's quite what was wanted for this assignment, but I don't know how to make an easy-to-reproduce image that looks decent.

Steps to reproduce above image:

1. Open Photoshop and create a new file (command N).

2. Set dimensions to 640x480. Press Enter.

3. Create a new layer (command shift N).

4. Press P (pen tool) and create an "s" type shape. When finished, right-click and choose "Fill Path". Press Enter.

5. Repeat steps 3 and 4.

6. Next open the gradient tool (press G) and then the gradient editor. Change the start and end colors to whatever you want. Add three more colors in between. Have these colors make up the hues that would be in-between the start and end colors if they were in a color cube.

7. Create a new layer. With the gradient tool still selected, click and drag the mouse from the top of the image to the bottom and then let go. This will create a nice gradient with the colors you chose.

8. Move the gradient layer just above one of the layers with the "s" shape from step 4. Right click the gradient layer and select "Create Clipping Mask". This makes it so the gradient will be in the shape of the shape you made with the pen tool.

9. Repeat steps 6-9 for the other "s" shape.

10. Create another layer and fill it with white using the paint bucket tool (press G).

11. Go to Filter -> Sketch -> Chalk & Charcoal. Make sure both chalk and charcoal are is set to 6 and stroke pressure is 1. Press Enter.

12. Make sure the new layer is at the very top and then set the blending mode of that layer to Screen.

That concludes the directions.

Thursday, March 3, 2011

Assignment 3: Scripting and Color Space (not completed)

1. Here's the RGB color cube and code:

for ($z = 0; $z < 8; ++$z)
{
for ($y = 0; $y < 8; ++$y)
{
for ($x = 0; $x < 8; ++$x)
{
$ball = `shadingNode -asShader lambert`;
$color = $ball + ".color";
setAttr $color -type double3 ($x/8.0) ($y/8.0) ($z/8.0);
$objname = `polySphere -ch on -o on -r .05`;

xform -translation ($x/8.0) ($y/8.0) ($z/8.0);

hyperShade -assign $ball;
}
}
}


2. Here's the RGB color wheel:

float $rad = .1;
$h = 10.0;
$s = 1.0/8.0;

for ($j = 0; $j < i =" 0;" ball =" `shadingNode" color =" $ball" hue =" ($h" sat =" $s" vect =" <<$hue,">>;
vector $col = hsv_to_rgb ($vect);
setAttr $color -type double3 ($col.x) ($col.y) ($col.z);
$objname = `polySphere -ch on -o on -r $rad`;

xform -translation ($j/8.0) 0 0;
move 0 0 0 $ball.scalePivot $ball.rotatePivot;
xform -ro 0 ($i*10) 0;

hyperShade -assign $ball;
}
$rad = $rad + .01;
}


This is all I have done at this point. It's not that I'm necessarily having trouble with the assignment, I've just had a terribly unlucky week with having lots of homework as well as getting real sick. I suppose I'm going to have to use a late day on this project. I figured I would just post what I have so far though.

Sunday, February 27, 2011

Journal Post 6

The spheres now get smaller in each ring as they near the center. I've been trying to also decrease the space between the rings so they're not so spread out near the center, but I'm going to give up on that for now. I want to get the colors to work first, then if I have time I'll work on the spacing some more.

The hsv to rgb code has been giving me some trouble. I feel that I need to declare it as a vector variable, but I can't figure out how to do that.

float $rad = .01;

for ($j = 1; $j <>

{

for ($i = 1; $i <>

{

$ball = `shadingNode -asShader lambert`;

$color = $ball + ".color";

vector $vect;

hsv_to_rgb <<$i, $j, .5>>;

//setAttr $color -type double3 ($vect.x) ($vect.y) ($vect.z);

$objname = `polySphere -ch on -o on -r $rad`;

xform -translation ($j/8.0) 0 0;

move 0 0 0 $ball.scalePivot $ball.rotatePivot;

xform -ro 0 ($i*10) 0;

hyperShade -assign $ball;

}

$rad = $rad + .01;

}


Wednesday, February 23, 2011

Journal Post 5

I started working on assignment 3. I have a basic circle made of spheres, but I haven't figured out how to deal with the colors yet. The circle looks a bit strange because the spheres get more and more crowded as they near the center and start to overlap. I think I'll try to change the radius of the spheres so they get smaller as they near the center. Either that or reduce the number of spheres in the rings the closer they get to the center.

for ($i = 1; $i < 37; ++$i)
{
for ($j = 1; $j < 9; ++$j)
{
$ball = `shadingNode -asShader lambert`;
$color = $ball + ".color";
$objname = `polySphere -ch on -o on -r .06`;

xform -translation ($j/8.0) 0 0;
move 0 0 0 $ball.scalePivot $ball.rotatePivot;
xform -ro 0 ($i*10) 0;
}
};

Thursday, February 17, 2011

Journal Post 4

My code for the color cube, with color this time. There's only about four more lines of code then before. The "ball" and "color" variables are assigned in the for-loops. A color is assigned to each sphere with RGB values corresponding to its x, y, and z position.

for ($z = 0; $z < 8; ++$z)
{
for ($y = 0; $y < 8; ++$y)
{
for ($x = 0; $x < 8; ++$x)
{
$ball = `shadingNode -asShader lambert`;
$color = $ball + ".color";
setAttr $color -type double3 ($x/8.0) ($y/8.0) ($z/8.0);
$objname = `polySphere -ch on -o on -r .05`;

xform -translation ($x/8.0) ($y/8.0) ($z/8.0);

hyperShade -assign $ball;
}
}
};