Thursday, March 31, 2011

Assignment 4.1 - Image Manipulation, Intermediate Scripting

Part 2.

I haven't figured out how to script the color blind image yet. I will describe what I have so far though. I read through the scripting guide while working on this assignment, which helped a ton. There were a lot of web pages that were helpful too, but I still couldn't figure out everything.

My first approach was to pretty much do what we did in class by copying one of the RGB channels of the image and pasting it in a new layer. My problem was actually copying what was in the channel. I was trying a select-all, copy, then paste, but that only worked for copying other layers.

My second approach was to create the channels myself by changing the original background layer. Luckily, I found a command called Channel Mixer that does exactly that. I just had to copy the background layer into a new layer then apply the Channel Mixer. Unluckily though, I couldn't figure out how to use that command while scripting. The closest thing I could find was a command called mixChannels. I couldn't get the same results using that command though, and it used CMY instead of RGB for some reason. If I can get that to work correctly, then I would just need to desaturate the image to match one of the channels.

I had problems with desaturating as well. I used the command: layer.HSBColor.saturation(-100), but the script kept complaining about it. Once I get through these issues it should be pretty straight forward, I hope. Here's the code I'm currently using. I'm going for a "Tritanomaly" color blindness, which makes it hard to distinguish between blue and yellow hues. It might be a little trickier than red/green discrimination because there's no yellow channel by default, but I should be able to make one without too much problem.


var curDoc = activeDocument

//blue channel layer
var layerBlue = curDoc.artLayers.add()
layerBlue.name = "Blue Channel"

curDoc.artLayers["Background"].copy()
curDoc.paste()

//yellow channel layer
var layerYellow = curDoc.artLayers.add()
layerYellow.name = "Yellow Channel"

curDoc.artLayers["Background"].copy()
curDoc.paste()

//code I used at some point and put aside for now:
//layerYellow.mixChannels ([[100,100,100,00],[100,100,100,00],[0,0,0,00]], false)
//layerRed.HSBColor.saturation(-100)
//redChannel = new Array (curDoc.channels[1])
//activeChannels = blueChannel
//curDoc.selection.selectAll()

Journal Post 9

A week or so ago in class we mentioned using the 3D feature of Photoshop and how you can import 3D models and paint on them. I've been playing around with that a bit by importing a chair model from Maya. Photoshop's 3D controls and capabilities are a bit convoluted, and painting directly on the chair didn't work very well. I watched and read a few tutorials, but none of them were too helpful when it came to modifying textures, which is what I was mostly interested in. You can add and manipulate the texture, like for my chair I added a wood texture, but I couldn't tell how it was mapped on to the geometry. I added a simple design to the seat of the chair, but I had to guess by using trial and error where on the texture file it would correspond to the seat. I would imagine there are better ways of painting your 3D model in Photoshop. Maybe if you create the UVs in Maya first? Might be something to check out further later on.

Here's the chair model in Photoshop: