Rif Motion Blur

return to main index


The python script presented here illustrates how a Rif can alter the visual characteristics of motion blur. Many thanks to Ali Jafargholi of the Savannah College of Art and Design for his help in developing the Rif and the model of the aircraft.

Figure 1 shows a model of a propeller aircraft that has been rendered using "standard" motion blur - activated by the Render Settings->Features->Motion Blur checkbox.

Figure 1
Standard motion blur

Figure 2 shows the aircraft rendered after the beauty rib has been filtered by the Rif shown in listing 1.

Figure 2
Modified motion blur

The Rif has modified the blur of the propeller so that it displays rotational blur but no translational blur. For the Rif to work properly the propeller has been parented to the "body" of the aircraft - figure 3.

Figure 3

Using the Rif

If the reader has installed the mel and python scripts given the tutorials,
    RfM: Batch Rendering and
    RfM: Batch Filtering
they should save listing 1 as rif_motionblur.py in their Maya/projects/RfM_python directory. Running the rif and displaying the image in "it" is then simply a matter of executing the following command in the Maya's script window.


Listing 1 (rif_motionblur.py)

import prman
class Rif(prman.Rif):
    activeShapeName = ''
    motionBlockOpen = False
    motionNumSamples = 0
    motionSample = -1
    lastGroupTransform = []
    def __init__(self, ri, args):
        self.parent = args[0]
        self.child = args[1]
        prman.Rif.__init__(self, ri)
    def Attribute(self, attrname, params):
        if attrname == 'identifier':
            self.activeShapeName = params['string name'][0]
        self.m_ri.Attribute(attrname, params)
        if self.activeShapeName == 'propeller':
            self.lastGroupTransform = []
    def MotionBegin(self, samples):
        if self.activeShapeName == self.parent:
            self.motionBlockOpen = True
            self.motionNumSamples = len(samples)
            self.motionSample = 0
    def ConcatTransform(self,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p):
        if self.motionBlockOpen:
            self.motionSample += 1
            # store the transform for shutter close
            if self.motionSample == self.motionNumSamples:
                self.motionSample = 0
    def MotionEnd(self):
        self.motionBlockOpen = False
        self.motionNumSamples = 0
        self.motionTransforms = []

© 2002- Malcolm Kesson. All rights reserved.