Monday, August 20, 2012

2D Volumetric rays in nuke

2D Volumetric rays

Here i'm going to explain Creating 2D Volumetric rays in nuke.


As a compositor and 3D artist every one really love Volumetric rays. Creating Volumetric rays in 3D packages such as Maya, 3dMax and any other 3D software’s are quit expensive. Its took long time to render for producing nice Volumetric rays.

Creating 2D Volumetric rays doesn’t look nice like rendered in 3D packages. But we can save some valuable times by create this effect in 2D.

You can create nice Volumetric rays effect like above image in Nuke. I used "Godrays" "Noise" and "roto" nodes to produce above result.

Here we go............

Step-1. Import image into nuke.

Step-2. Draw a roto shape to the light. If you have matte (alpha) will use that
            instead off roto.


Step-3. Add "GodRays" node and connect it to "roto" node. Move the center point
            to the opposite  direction off rays direction. Here i placed the center
            point to the left upper side of the image.


Step-4. Change the "GodRays" scale value. I set 4.5 as scale value.
            GodRays default scale value is 1. ( change as per your need )

            This will give you blow result:



Step-5. Change the "steps" knob value to 8 will give you the below nice and
            smooth result.


Step-6. Composite this result with input.


It looks nice. But.... hold on a second. I like to fade off my rays when its reaches the ground. How to do that.

Here is the solution.

Step-7. Again go to GodRays and adjust the "knob" called 'to color'.


Reduced 'to color' knob value will give below result:

 Now its look really nice and fallen off. But its not the final result, you showed first??.

How to create the breakups on the rays. Means lights breaking through some objects. In 3D packages will add some objects for light cut through that. But how to mimic that effect in 2D.

Its really simple one. Artistic approach will help us to mimic this effect.

Step-8. Create a 'Noise' node and multiply it with the "roto" node.


This will give you the below final result:


Adjust the noise value as per your need.

You  can change the rays color by adjusting color value of 'from color' and 'to color' knob on GodRays node.

example:


Multiple roto shapes will produce some nice Volumetric rays.


One more example:





Hope this will help you guys.

Nuke file: https://skydrive.live.com/redir?resid=776F8351D9892B6A!270



Sunday, August 19, 2012

chromatic aberration

chromatic aberration

 Most people doesn’t understand What is "chromatic aberration"and struggle to handle it on post production. Here is simple solution to understand and produce good result in post.

First is first..

What is chromatic aberration?

Chromatic Aberration, also known as “color fringing” or “purple fringing”, is a common optical problem that occurs when a lens is either unable to bring all wavelengths of color to the same focal plane, and/or when wavelengths of color are focused at different positions in the focal plane.


Look below image Right side. You can see the red color (fringing) bleeds on the object edges.Its because of chromatic aberration.


 How its happen?

Chromatic aberration is caused by lens dispersion, with different colors of light travelling at different speeds while passing through a lens. As a result, the image can look blurred or noticeable colored edges (red, green, blue, yellow, purple, magenta) can appear around objects, especially in high-contrast situations.


 Types of aberrations.

1. longitudinal chromatic aberration 2. Transverse chromatic aberration



 How to mimic this effect in Nuke?

Create chromatic aberration in Nuke is really simple one. "Transform" "TransformMasked" and "Lens distortion" nodes will help you to create chromatic aberration effect.
(Some gizmos are available in internet)



Transform node will create aberration effect to entire image. See blow example image.
(Here i used scale knob on Transform node to create aberration)

Before and After result:


Using "TransformMasked" tool will allow you to create aberration in specified place on the image.


Result:


How to convert this process as a custom "gizmo" in nuke.

step-1. select all nodes expect input and roto nodes. Go to-->Other-->Group and click. Keyboard short-cut "alt+g".

step-2. Once make the group go to "Group1 Node Graph" and give the name to inputs and connect the output to last node.



step-3. Go to node graph and start to add custom knobs by selecting "manage user knob".



step-4. After add custom knobs start to connect the knobs via expression.

           " aberration channel checkbox" to "Transform" nodes disable knob.
             expression - (parent.red)-1

           " aberration_value " to "Transform" nodes "translate.x" knob.
             expression - parent.aberration_value
(Here i used X Translation to create aberration, You can use scale Instead of x)

step-5. Export the "Group" as a gizmo.


Add this gizmo in to your nuke plug-in path and enjoy.





Saturday, August 11, 2012

Getting roto shapes name

Getting roto shapes name

gettingRotoNames.py script will print all the "Roto" shapes and "Layers" name in all the Roto nodes. 

This script goes down 4 child layers deep and get all the shapes and layers. If want to go further you can add some more by editing this code.

 def gettingRotoNames():
    for rpNode in nuke.allNodes('Roto'):
        cKnob= rpNode['curves']
        root = cKnob.rootLayer
        print '\n' + root.name
        for e in cKnob.rootLayer:   
            print ' - ' + e.name
            if isinstance(e, nuke.rotopaint.Shape):
                pass
            else:
                for i in cKnob.toElement(e.name):
                    print '   - ' + i.name
                    if isinstance(i, nuke.rotopaint.Shape):
                        pass
                    else:
                        for o in cKnob.toElement(e.name + '/' + i.name):
                            print '     - ' + o.name
                        if isinstance(o, nuke.rotopaint.Shape):
                            pass
                        else:
                            for u in cKnob.toElement(e.name + '/' + i.name + '/' + o.name):
                                print '       - ' + u.name
                                if isinstance(u, nuke.rotopaint.Shape):
                                    pass
gettingRotoNames() 

_________________________________________________________________________________________

Below code will create text file and store's the name of your roto on to it.

Replace the path ( highlighted in green color) as per your need.

f = open('/home/satheesh/Documents/Test', 'w')
def gettingRotoNames():
    for rpNode in nuke.allNodes('Roto'):
        cKnob= rpNode['curves']
        root = cKnob.rootLayer
        f.write('\n' + root.name)
        for e in cKnob.rootLayer:   
            f.write(' - ' + e.name)
            if isinstance(e, nuke.rotopaint.Shape):
                pass
            else:
                for i in cKnob.toElement(e.name):
                    f.write('   - ' + i.name)
                    if isinstance(i, nuke.rotopaint.Shape):
                        pass
                    else:
                        for o in cKnob.toElement(e.name + '/' + i.name):
                            f.write('     - ' + o.name)
                        if isinstance(o, nuke.rotopaint.Shape):
                            pass
                        else:
                            for u in cKnob.toElement(e.name + '/' + i.name + '/' + o.name):
                                f.write('       - ' + u.name)
                                if isinstance(u, nuke.rotopaint.Shape):
                                    pass
                            f.close()
gettingRotoNames()


scale up and down cornerpin node

global scale up and down cornerpin This script help you to global scale up or down the selected cornerpin. Recently i had situation to ...