AWS Thinkbox Discussion Forums

Basic Compositing with draft

Hi,

i want my fx supervisor to be able to watch is smoke effect over our rendered shot.
I think this is duable with draft and at the same time. Saving us a license of nuke.
Could you implement an option, in the draft submitter, to input another sequence telling draft to composite under the main sequence.

Thanks

Fred

Are you familiar with the use of the “Additional Args” field? You can add additional input parameters there, for example:

inFileSmoke=path/to/smoke/frames_####.exr

And then, in the expected types dictionary sent to ParseCommandLine, add:

expectedTypes['inFileSmoke'] = '<string>'

This would give you access to the file name for the smoke images, which you could then composite before encoding. Let me know if this makes sense.

Cheers,
Andrea

Fred, here’s a sample script that uses the additional args to specify a set of smoke frames (same frame numbers as the regular frames), and composites them over the regular frames before adding to the video:

# When submitting this script to Deadline, the following Draft Options should be set:
# 	Input File:  Select one of the frames in the sequence that will be processed.
# 	Output File:  Leave it as Deadline auto-fills, or select an alternate location/name for the movie file.
# 	Frame List:  Leave it as Deadline auto-fills, or specify a subset of the frames.
# 	Additional Args:  inFileSmoke=path/to/smoke_frames_###.ext (where ### represents a three digit frame number, due to there being three hash marks.)

import Draft
import sys	# To access commmand line arguments.  Deadline sends script parameters as command line arguments.
from DraftParamParser import *	# Functions to process command line arguments for Draft.

# The argument name/types we're expecting from the command line arguments or Deadline.
expectedTypes = dict()
expectedTypes['inFile'] = '<string>'
expectedTypes['outFile'] = '<string>'
expectedTypes['frameList'] = '<string>'
expectedTypes['inFileSmoke'] = '<string>'

# Parse the command line arguments.
params = ParseCommandLine( expectedTypes, sys.argv )	# params now contains a dictionary of the parameters initialized to values from the command line arguments.
inFilePattern = params['inFile']	# The pattern that the input files follow, for example frame_name_###.ext, where ### represents a three digit frame number.
inFileSmokePattern = params['inFileSmoke']	# The pattern that the smoke input files follow, for example frame_name_###.ext, where ### represents a three digit frame number.
frames = FrameRangeToFrames( params['frameList'] )	# Get a list of the individual frames we are to process

# Initialize the video encoder.
encoder = Draft.VideoEncoder( params['outFile'] )

# Process each of the frames in the list of frames (including the first, which hasn't yet been added to the encoder).
for currFrame in frames:
	# Read in the frame.
	currFile = ReplaceFilenameHashesWithNumber( inFilePattern, currFrame )
	frame = Draft.Image.ReadFromFile( currFile )
	
	# Read in the smoke.
	currSmokeFile = ReplaceFilenameHashesWithNumber( inFileSmokePattern, currFrame )
	smokeframe = Draft.Image.ReadFromFile( currSmokeFile )
	
	# Composite smoke over frame.
	frame.Composite( smokeframe, 0, 0, Draft.CompositeOperator.OverCompositeOp )
	
	# Add the frame to the encoder.
	encoder.EncodeNextFrame( frame )

# Finalize and save the resulting video.
encoder.FinalizeEncoding()
Privacy | Site terms | Cookie preferences