Copy link to clipboard
Copied
I'm trying to generate a depth pass from rack focus. Basically where I've gotten to right now is importing the rack focus footage each frame from as an individual layer. Then running Auto Blend Layers and letting photoshop do it's magic to mask out each layer's out of focus information. This basically gives me a bunch of layers that tell me exactly where the camera's focus was at each frame in the shot. What I need to do now is Add a color overlay (maybe in the form of a layer style) that starts at 100% black and goes to 100% white stepping through each layer.
Right now I have this, which is so very far away.
try {
var docName = app.activeDocument.name; // save the app.activeDocument name before duplicate.
var layerCount = app.documents[docName].layers.length; //figure out how many layers
var colorStep = 255/layerCount; //figure out how big the step of grey is between each layer.
for (i = 1; i <= layerCount; i++){
my_layer = [docName].layer(i);
my_layer.applyStyle (solidFill) //add the color overly layer style
//color the overlay using the colorStep information and layer number
}
}
}
What I want is an end result that looks like this.
Copy link to clipboard
Copied
The only focus stacking I have done is with macro photography. Below is a script that adds the layer effects but the results with my macro samples did not turn out looking good. Maybe you will have better luck with the type of photography you are doing.
function ftn1(r,g,b) {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putProperty( charIDToTypeID('Prpr'), charIDToTypeID('Lefx') );
ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
desc.putReference( charIDToTypeID('null'), ref );
var effectsDesc = new ActionDescriptor();
//effectsDesc.putUnitDouble( charIDToTypeID('Scl '), charIDToTypeID('#Prc'), 333.333333 );
var colorfillDesc = new ActionDescriptor();
colorfillDesc.putBoolean( charIDToTypeID('enab'), true );
colorfillDesc.putEnumerated( charIDToTypeID('Md '), charIDToTypeID('BlnM'), charIDToTypeID('Nrml') );
colorfillDesc.putUnitDouble( charIDToTypeID('Opct'), charIDToTypeID('#Prc'), 100.000000 );
var rgbcDesc = new ActionDescriptor();
rgbcDesc.putDouble( charIDToTypeID('Rd '), r );
rgbcDesc.putDouble( charIDToTypeID('Grn '), g );
rgbcDesc.putDouble( charIDToTypeID('Bl '), b );
colorfillDesc.putObject( charIDToTypeID('Clr '), charIDToTypeID('RGBC'), rgbcDesc );
effectsDesc.putObject( charIDToTypeID('SoFi'), charIDToTypeID('SoFi'), colorfillDesc );
desc.putObject( charIDToTypeID('T '), charIDToTypeID('Lefx'), effectsDesc );
executeAction( charIDToTypeID('setd'), desc, DialogModes.NO );
};
try {
// var docName = app.activeDocument.name; // save the app.activeDocument name before duplicate.
// var layerCount = app.documents[docName].layers.length; //figure out how many layers
var docRef = app.activeDocument;
var layerCount = docRef.artLayers.length;
var colorStep = 255/layerCount; //figure out how big the step of grey is between each layer.
var color = 255;
for (i = 0; i <= layerCount; i++){
docRef.activeLayer = docRef.artLayers;
ftn1( color, color, color);
color=color-colorStep;
}
}catch(e){}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now