Afrikaans
Akan
Albanian
Amharic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
hello and welcome back to nuke 2 3 1
nuke composity best practices
this is Victor Perez
and in this class
which is class No. 9
we are going to start
talking about optimization of the 3D renders
so we're going to talk about this can line render note
okay so let's start by one of the most obvious things
which is the format of the skyline render
okay you know that the skyline render has three inputs
one for the object or the scene
the camera and then there is the mysterious input
of the background well
make no mistake here
because the background is not defined
to put the actual background of the composition
even if you can
then if you do that
you cannot separate
the object you are rendering from the background
so we used to put
ah reformat
so the only information this background input
is going to grab from this reformat node
is the actual format
just to output my image in this format
what if you use another note well
there is many people that
instead of using the reformat
they prefer to use the constant
but this is wrong why
look at the boundary box
in theory this reformat
and this constant have the same information
but it's not true
because in the reformat
you get the format of the image with nothing inside
and for nothing
I mean there is no information
as you can see here
I'm just grabbing the information with the color picker
as you can see
but here there is nothing
while in the constant
when you pick
in here you have information
but that information is zero
but it's not the same
have no information
to have information
equals to 0 in every pixel
because in here
your boundary box
is going to process every single pixel
and to be honest with you
nuke doesn't care
if that information is equals to 0
or equals to 2000
is the same
that this information is going to be calculated
so when you are applying the format
to the scanline render
never use a constant
use a reformat instead
okay so that is going to limit the process
of your scan line render
which is an old
that sadly is quite slow to render
and is going to limit that
to this boundary box
which is defining the geometry
okay so remember that the boundary box
in a projection
for instance
is not matching the alpha
or the boundary box
of the image you are projecting
the boundary marks from the scanline render
is always going to match
the geometry
that is going to be rendered out
okay so if you see here
the same image
has no boundary box
is all to the format
okay so another thing is
why not to put anything in there
so leave the input open
well if you do that
and then by any chance
you copy and paste this note
to another project
that is using another project
settings for the full format size
then your skyline render is going to change
and everything else is gonna change
so it's not a good idea
to leave the background input open
you need to put something
and when you put the reformat like here
don't leave the reformat
at the root format
instead use a format in here
so by default
the root format
is going to take
the format of your Priyat
so if your Priyat is set
like you here
at 2K Super 35
for aperture yes
put it in here
don't leave it
to the root
because if you put a reformat
and then you leave
to the root
is exactly the same as putting
nothing okay
so you have to specify
the format in here okay
so that is going to create
a right format
that is going to
be perfectly fit
with the background plate
and then you just need to put a merge
and put this over
or any other operation of your choice okay
now another thing that is very interesting
when we are working with the skyline render
is sometimes we have an image like this okay um
maybe you want to apply a certain process to this image
okay that process can be
for instance
a color correction
or a convolution
for creating
for instance
a glow or any other process you want to apply
so how to do that
well depending on the operation
you want to use one method or another
okay so imagine that I want to create
some kind of color correction
okay so if I have this
and this is my alpha
there is no way you can separate that
but remember
the scanning render is going to render every channel
you are putting inside the UVs of your geometry
saying with the predictions okay
so if you having here a prediction of gas r g b a
the output result is going to be RGBA
but if I want to isolate
for instance
this first sphere okay
that is corresponding to this okay
what I want is just to create kind of ID pass remember
the ID pass is the pass that is going to give me a mat
for a certain element or geometry
okay so how to create that
well it's going to be really
really easy
I'm going to call a shuffle note
and then I'm going to place that shuffle note in here
and in this case in
instead of taking any pass from my original image
and then placing into the RGB
what I'm going to do is
I'm going to take one output layer of my choice
that can be
for instance
the mask or
if you prefer
you can create it yourself
so in this case
I'm going to put the mask
because I just want one single channel
and now I'm going to feel that mask with full 1 value
so if you look at this
this is RGB
now this is the a
okay and now
if I go in here
the mask here you are
this is the information of my mask
that is display
by the way in red
just because it's the only channel available
but it's not that
my mask is red
is I'm just caring about one single channel
and the first channel available in nuke
he's the red one
so that's why the aparency of my mask is red
so let's go back to the RGBA set
okay and now
if I see my output
you will see our GBA
okay but attention
what is happening in here
now I have an extra channel
okay that extra channel is the mask
but he's being applied only to this geometry
so if I go here
to the mask
here you are
so now that mask is isolated
so if I want to apply a certain effect
I just need to go here
great now I'm going to use the mask
okay so now I'm going to create that certain effect
for that piece of geometry okay
but that is actually not perfectly accurate
when I want to create a color correction
can you see what is happening in here
the edge is creating that glowy effect
and that's because I'm using a mask
that is matching the alpha
so it's exactly the same effect of applying
instead of a mask for the ID
I'm going to apply the mask for the alpha
so now the same effect is happening for everything
and as you know
you never use the alpha as a mask
the alpha must be used as a pre multiplication process
okay so you unpro multiply
you then apply the process
and then you pre multiply
this is something that you cannot accomplish
with this process
because if you use the mask for um
primitiplication
something like here the mask
then everything is going to disappear
because he's applying a non primal duplication
and then the primal duplication by this shape
which is just creating that effect
and even if you force that
and you for instance
instead of doing that automatically inside the node
you prefer to do it manually with nodes
so I'm going to call it here
the amprimoult
so I'm going to amprimoult by the mask
and then to premoult after by the
alpha okay so in here
you get that
and in here
everything looks fine
except those edges
and those edges
so there is no way you can change the color
with that extreme color correction
by using a mask
that mask can be used very nicely for a glow
or for delimitating
any effect of convolutions that it is okay
or to mask other
effects that you can apply to the other spheres
like set blur or something like that
actually this method of isolation
is not great for color correction
okay so how do you do that
in case you want to isolate an element well
that is nothing better than getting your sphere
separate in a different render
but in this case
is going to be really easy
if you apply this fear to be the first fear
so everything is going to be under this fear
in a layer combination okay
but what if this fear I want to change is the green one
well things can get complicated
okay so I'm going to show you how to integrate
deep image compositing to apply that certain effect
so in here I have
the render of my red and the blue spheres
and here I have the render for the green sphere okay
you know that automatically
even if you don't want to
this calendar is releasing the deep information okay
so if you use something as simple as the deep merch
here you are
you are going to get this merch
and you are going to mix this and this
and together
here you are
okay so he's going to respect what is in front
of my green sphere and what is beyond my green sphere
that's very nice
the problem is
as soon as you put a node after this can line render
the information
of the deep image compositing is going to get lost
so how can you manipulate maybe your green sphere
and still maintain this deep image compositing setup
well for that
we need to get a little work around
using another note of deep image compositing
which is in this case
the deep holdout
so the deep holdout is going to create the hole in here
just to place this green sphere
using an operation that is not the over
okay every time we are using a holdout
we are going to use the
this joint over
I'm going to show you now
but first let's apply the deep holdout
so in here you are going to apply the image
that you want to crop from this image
okay so that is the holdout input
and then because this is my main element
that is going to be feed into the main input
remember that the holdout is a note
that is a processing deep image
but the result
the output is going to be a regular to the image okay
that's why you are getting in this note
the rectangles of the color
so every note that has the rectangles of the colors
corresponding the channels
that is a to the process
okay so in here
if I apply this to this
the result is going to be that
so is the portion of the sphere
that is reveal by the rest of the scene
so the red sphere in front of the green
is now cropping those pixels okay
um before to apply a glow
because this is very simple
you apply a glow
and then you put in everything together
I want you to think about something
remember that we are applying
a mask to crop those pixels
okay so if we put anover
the effect that we are using is we have that
and this
of course in this schematic drawing is very clear
in reality this is happening exactly the same
which is this area is not touching
well it's actually very very
very similar in the value
so if you use an over
probably you're not going to notice much
but as soon as you are getting motion blur
or soft edges
this portion of the edge of the alpha
not being perfectly match
with the image above and below
is going to create a dark edge
okay so if you don't want to have that dark edge
is better that you don't use and over
because the over is designed to put two images
that are just a main image with transparency
over a full cover image
but in here
we have already my image pre cut
so if I put this and this
to deactivate the glow
and to show you
have a look at those pixels
this is kind of pinky
and this is kind of green
so in here we have this tiny
tiny variation in the value that is getting dark
which is because in there you have actually dark values
and in here
you have the same dark value
so when you put those pixels together
you don't get the full amount of value
just to represent the perfect blend
from the pink to the green
so when you have this effect
you have to use the this join over
okay the this join over represents
when the alpha is not perfectly feeling all the gaps
so with the this join over
you're going to get this perfect sense of blending
of an image with the holdout
okay so with this drainover
everything is looking great
so I'm going to check if this and this
which is the deep image
with the merch
and these with the this join
are accurate
okay so here you are
perfectly accurate
from one to the other
okay notice that in here
if I change
and I compare the over and the deep match see
this is the edge I was talking about okay
now that we have that merge perfectly mixing my images
now I can apply the process
and if you want to apply the process
you can apply the glow
and everything is going to work fine
even the pixels that are getting greenish
on the pinky area
but not only in here
I can also apply a great
and in this case
because this image is just a pre multiply image
I can apply in here
yes I'm promote remote from the note
and then I can change anything
and is going to look perfect in every single pixel
okay so this way
using the deep image compositing
is going to speed up your overflow
and is going to avoid you
to create three layers of the skyline render
one from the red sphere
one for the green sphere
and one for the blue sphere
and in this case
is really easy
because they are not touching from one to the other
but when you have things that are going
one in front of the other
and then back behind
then everything is going to be a bit messy
so using deep image compositing
for this kind of holding out
is going to help a lot okay
so that is for layering
using advanced techniques of this calendar
another thing
that we have to keep in consideration is that
when you are rendering an image with motion blur
everybody knows that the motion blur
is actually being created by samples
so I'm going to show you
in the skyline render how the samples work
so here we have the multi sample
so the amount of motion blur
and the amount
I mean how long is the tail of your motion blur
is going to depend in terms of quality
of the amount of samples you are going to apply in here
because the samples are just a render of the same image
in different position of times
in between the frame
so is rendering from frame 1 to frame 2
several different positions in time
so let's say
render 1.1 frame 1.2
frames 1.3 and so on
it's something that is going to
blend in one single frame
so you are going to have
the feeling that that image is actually moving
but is related with the amount of samples
and the amount of samples is as plain as
you are rendering this image 100 times
in this case
if you render twice
that is going to take twice the time for rendering
if you put 5
is going to take five times
as you can see
it's really clear that if you put 3
you can see the shape of my image three times okay
and he's blending everything together
but to get a good effect
depending on the amount of mushroom blood
you are going to need several samples
so in here I decide to put 100
some of you can think now okay
if I render something complex 100 times
that is going to take a lot of time for calculation
and that's true
so then in here
if you don't want to calculate the samples
you can calculate what is called
a motion vector pass
and in nuke
you have different kind of motion vectors
depending on the information you want to represent
okay by default
you are going to get distance okay
which is the distant
that every pixel is representing movement
in this case
forward okay
from one pixel to another
so then once you have that pass
which is looking something like this okay
is representing in u v
which is the relative coordinates x y
he's representing
the distance from this pixel to the next one
intense of movement
so using that information
which is baked in the render
pixel by pixel
I can use what is called a vector blur
the vector blur is in here
and it's going to apply that
a movement of every pixel
leaving the trail
from the original position
to the position of destination
in both X and Y
but keep this in mind
is just X and y
there is noted in here
so you cannot create 3D motion blur in here even
because what you are doing here
is just a compolution of pixels
based on a matrics of movement
but is just
that is very different from getting the image render
in several different positions in time
between one frame to another
in here is just plain movement into the
so when you apply those motion vectors to the image
you get something like that
which is more or less similar to the final image okay
as you can see
there are artifacts
and that's normal okay
with the vector blur
I apply a certain channel
then I use my alpha to define
what part of my image needs to be moved okay
and then I was applying the amplitude of my movement
so I don't care about the setup of this vector blur
what I care is about the process itself
and the process
let me tell you that
calculating the motion blur
using the vector blur is not a great
sometimes you can be lucky and don't get
those artifacts
but most of the time is kind of dangerous to apply that
and even if the result is quite similar
the quality of the motion blur from the 3D
and the vector blur is so different
there is no way you can even compare the result in here
is is just a process of today
but your brain is going to be very smart
and is going to understand
when that motion blur is real or not
even if in the skyline render
the motion blur that we are calculating
is just a linear fashion motion blur
so it's a mathematical way of representing
the soup information from the time
while in here
you have just
in this case
24 segments of time
but we are inventing
the information that is in between those frames
the vector blur is not a good idea
just try it
but just a tiny amount
because the vector blur
he's not going to be used
in general I like to use the vector blur
and to apply the motion blur
when I'm applying a patch over a CG
and then I need to
create the movement of that patch in the CG
with the same
more or less
fashion of the movement okay
but by default
I would never recommend you to use
the vector blur for general motion blur okay
still if you want to get better
results with your motion blur
I'm going to give you an advice
which is in here
you have this randomized time
I'm going to reduce
my samples by 20
so you are going to see clearly
the pattern
of the linear representation
I mean linear
because the distance between all samples
is arapematically the same
okay so in here
everything is looking like
mathematically perfect
but you can apply
what is called a randomization of the time
so is going to take
different distance
for every sample
so that is going to hide
the effect of Muay
for instance
which is those lines
doing weird things
when they duplicate
like in here
and that is going to hide many problems
of course you are not going to resolve
hold the problems of the samples
but my aiming here
is how to provide you the information
to render your image
to look fine
without having a crazy amount of samples
so if we randomize the time
we can create that irregularity
okay so in here
you can see very clear in those lines
that the space between the lines
is not the same as when you were in here
see that everything
all the distances are quite the same
okay so if I increasing here
and I put one that is going to be randomized
and that this is starting to help
of course he's not perfect
but he's starting to help
then another thing that can help
is the use of the stochastic samples
this torcastic sample
is going to render more information
where you can see it
and less information in the areas that are not
so important
and we are talking in here about perception
so nuke is deciding where to use more information
where the information is more dense
and then applying less information
that is going to create an effect of noise
because it's going to create clusters of information
so we are going to increase by zero
you are getting just nothing
but as soon as you put one
you are going to start getting information in there
one is very
very very low
so in this case
as you can see here
I have a good density of points
and then in here
that's not much
see that there is nothing in there
it's just valued zero
okay of course
if you are at this distance
probably you are going to be more or less fine
but it's not a good idea to use just one
so we are going to increase
up to the point that we can just get things to work
good for us
don't get confused
this is not grain or noise
this is that the result of getting the information
group in clusters of a perception okay
so with this difference is
is going to take way less
of course is related with the definition of my image
if you have a very
very noisy image
that is going to create this kind of noisy pattern
okay but in terms of the quality
you need to get the final result of your image
and then balance the stochastic samples as well
okay so pray
you get a good balance in there
okay then once you have your good balance in there
just try to apply the sample diameters
the sample diameter is related with the antialias
so is how big is the circle of pixels
just to create the amount of antialia
so the higher this is going to be
the more accurate antialia as you are going to get
that is for very precise calculation
in this case
because the motion blur is so high
then you are not going to get
that increase in the quality okay
the focus diameter
of course is related with the death of feel
of the camera that you set up
so I'm not going to talk about this
but this is going to be the effect of the set blur
done in camera
so as you can imagine
that said blur is just a combination
as the vector blur
but if you create the difocus
directly from the calendar
is going to work way better
okay so the focus diameter is just going to define
the amount of distribution of your samples okay
good so now
once I have my setup
I can increase
and see now
by using 50 samples
probably I'm going to get a quite decent result
and by combining the stochastic samples
and the amount of samples
and reducing the time of the render by a huge fraction
even if I was using the hundred samples
that I was using initially
the stocastic samples
are going to reduce the time of the render
because he's not using the full precision
of every single pixel for blending the samples
okay so the stocastic sample can be a very good asset
to reduce the render time okay
another thing that is interesting
when we are working with the scanline render
is to use your channels wisely
so in this case
for instance
I'm creating my motion blur
directly from my skyline render
which means that probably
I don't need my UV representing the motion vectors okay
but in here
by the fault
this calendar is providing me with the motion vectors
so what you want
is to render just the information you need
so here you go to this shader
and then motion vectors off
as you can see
here you are rendering to channel less
okay that's good
and then you can say okay
and what if I don't want my channel
because in here
I'm rendering also the death information well
there is no way you can remove that channel
even if you remove the set buffer or the transparency
that's not related
okay so if you want to get rid of that channel
you just go in here
remove and then you can either remove the deaf
okay so is bypassing the other channels that's away
or if you prefer
you keep just the RGBA
okay so he's going to discard
any information that you don't need in there
so that is going to create a very clean stream
lining here with just the channels you really want
okay and now we are going to discuss the boundary box
in relation with the lens distortion
so I have this image
with the camera that I provided you
and then in here
I have the render of my cones okay
so those cones are representing
certain areas of the 3D space okay
but in here
in order to match my virtual image
with the original plate
I need to get my lenses torsion align
and let me underline this point
you never touch the original plate
by using the and distort for compositing reasons
you use the and distortion
just for calculating your camera
when you are applying the much more process
but never never use this
which is from the calendar
then you apply the and distortion to the image
and then put both together because
yeah it's true
they are both align in terms of lenses torsion
but you are breaking in here
one of the principles of the capacity
which is you are touching
something that is not mean to be touched
which is the background plate
if you don't have a particular task
that requires that be touched
so you are losing a huge amount of quality
with the lens distortion
which is applying a filter
okay so never do that
what you want is just to apply
the lens distortion in here
just to read
distort your CG
in order to match the original plate
with the distortion
um this is happening always
there is no exception
all cameras in the world
have a certain amount of lens distortion
some of them
they have more
some of them have less
but there is always some
okay so if I apply this
to the process I did before with the stochastic samples
okay you will see that now
because of the filter I'm using here see that
you are getting a bit of the reduction of that crane
so you can play back with the stocastic samples
and the filtering here
so if I use something like the notch
see that now is reducing
because he's blending those samples okay
so this is something that you can play with
in case you need it
so let's get back in here
so I apply my lens distortion to this
and what is this
well this is totally normal
is because when you are applying
the lens distortion to your image
you are doing this
you are and distorting your image
by taking the corners and stretching them out
okay so the image seems to be enlarging
I'm going to show you in here by using a black outside
okay and then in here a note that I have in my toolbox
which is the box to format
so can you see what's happening in the edges
the image is getting a stretch in the corners
so if I change from there
see that the image is actually looking like
the center is getting back
but it's actually the other way around is the corners
so this is a non linear transformation of the image
okay but what is actually happening is that this image
that is getting outside
because we are stretching the corners
then when you apply redistort
those areas that are outside are getting back inside
okay but what if I apply this
and then I crop my edges so
I'm going to
cropping here okay
see what's going on
is because this crop is erasing all the information
that was in those corners
outside the image
so the first thing we cannot serve is
the boundary box is expanding okay
so what is happening to the scanline render
is exactly that
your render is just up to the format
so when you apply the redistort
those pixels that are supposed to be outside
with the boundary box are not there anymore
so this calendar is just rendering the format
and then in here
the format is getting inside
so you are getting the regular issue of the expansion
of the last pixel touching the boundary box
okay so how can we fix that
well there is a feature in the scan line render
that is called the overscan
so the overscan is just mean to expand
whatever is not seen by the camera outside the format
but is information that in a regular 3D virtual world
we can apply
so we can apply that
and you can feel how the boundary box is expanding
okay so when I move
for instance in here
I'm going to apply a transform
just to move
we are going to reveal a piece of the corn
that is not seen
as we did in the class talking about
the boundary box
see the cone is in there
so if I restored that
the information outside is going to be now insight
due to the calculations of the lens distortion
so now when I apply that to the image
that is going to appear correctly
the point is
how they overcome
should be well as big enough to cover that
so it's something that you are going to operate by eye
my advice is
when you are going to calculate the oberscan
go to the corners of the image
so in case your cones
are getting to the corner of the image
that is the most critical piece of the image
because remember that the lenses torsion
is actually stretching from the corners of the image
okay so there is going to be easier
and then add a few pixels more in the overscan okay
just to be sure you are not cropping
but be careful
because the higher is the overscan
the more pixels you are going to render
from your scan line render
so you just want to keep the scan line render
with less pixels to be render as possible
without sacrifice the information you need
then another thing that I used to do is I always
when I use the merch
put the information coming from the virtual world
with the original plate
usually I don't want to change
that information in terms of transformation
so what I do is just to simply crop my boundary box
and limit that to the B input
which is the original plate
so in here B
and now the boundary box
is perfectly fit with all the information inside
so I hope you enjoyed this
set of tricks and methods for working with the 3D world
okay so that's all for this week
if you have any comments
questions or suggestions
you are very welcome to post in the forums
until next time
this has been Victor Perez for effects PhD
thanks for watching
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.