Affichage des articles dont le libellé est TCL. Afficher tous les articles
Affichage des articles dont le libellé est TCL. Afficher tous les articles

dimanche 24 janvier 2016

Convert Normal Pass Between World and Camera



http://www.nukepedia.com/gizmos/3d/cfakepathconvert_normal

Let's talk about Normals !

Normals are vectors that indicate a face direction compared to a original vector (the camera or the world)

To change this origin from the camera to the world or the other way arround. We have to use an rotation matrice.

For that, the node "color matrix" used with the three first column of the Camera World Matrix does the work pretty well !

But there is one thing, this method doesn't compute the focal length !
So here is my trick :

I use three cameras with three different orientations : X, Y and Z :


This three cameras are shooting a sphere (parented to cam) to get the reference normals for every axis. This way, the reference takes the focal length in consideration.

Then, for each axis, I do a scalar product with a merge expression between the original normal passe and the reference normal passe I got shooting the sphere.


I copy the 3 result in a new passe, and I got the converted normals.

For the facing ratio, it's the Z (or the blue) of the camera normals. :)

dimanche 29 novembre 2015

Unlimited Camera Transition



http://www.nukepedia.com/gizmos/3d/fusioncam

This is actually the first interesting script I've done in nuke.
I wanted to improve the common expression used to make a camera transition :

1-sliderValue*Camera1.translate + sliderValue*Camera2.translate

In order to use it with an unlimited amount of camera, I modified a switch node : easy way to have an unlimited number of input branches.

Then the expression goes like this (gizmo is the created switch node) :

(1 - sliderValue - int(sliderValue)) * gizmo.input(int(sliderValue)).translate +
(sliderValue - int(sliderValue)) * gizmo.input(int(sliderValue) + 1).translate

Substracting the sliderValue converted in int conforms the sliderValue between 0 and 1, then the expression works the same but instead of Camera1 and Camera2, we have Camera(int(sliderValue)) et Camera(int(sliderValue) + 1) 

This expression doesn't work when sliderValue = int(sliderValue) so I had to add an exception :
if sliderValue == int(sliderValue) : gizmo.input(int(sliderValue)).translate

I'm not using the real nuke tcl syntax in order to explain it. You can find the full expression in the gizmo.

If you have any trouble installing, using or understanding this tool, please ask. I'll be very happy to help !