Tip:
Highlight text to annotate it
X
Hi everyone, thanks for watching 3DMotive.com.
My name is Gregory Murels and today we're going
to be talking about creating and using
light functions in UDK.
This tutorial is a beginner's tutorial and
assumes that you have basic knowledge of
importing assets into UDK,
as well as creating materials.
I'll be making sure to let you guys know of any
keyboard shortcuts I use over
the course of this video.
So let's get started.
A light function is a way of taking an ordinary
UDK light, like this one right here,
and applying a material to the light
to allow us to create a cool effect.
Now, light functions are used with any
of the dynamic lights, so togglable or
movable lights and a light function is actually
a material that has a specific set of parameters
that we plug into the light.
Light functions have a bunch of
different varieties of uses.
Some of them can be for creating a
stained-glass window or the shadow from a fan
or other moving shadows, as well as flickering lights
which is the example that
we're going to be using here.
Let's get started in actually creating our
light function material.
So I'm going to open up our content browser
and as you can see I've already created this
light function material and I'm going to open it
and I'm going to create it as well as show you guys
the material that I've created.
Before we actually create our material, I have to
do some stuff to actually set up our material
to be a light function.
The first thing we do is click on our
preview material and under the material drop down
right here, under the lighting model,
I have mine set to MLM Unlit.
So if you just click the rollout, yours will be
set to MLM Fong; set it to MLM Unlit.
The next thing we need to do is go down to our
mutually exclusive usage and set and click
Used as Light Function.
This will tell the material that this specific
material will be used as a light function.
Now you should only have you
an admissive channel turned on.
Now, our material is comprised of seven nodes.
It's very simple, we have a time node,
two cosign nodes, two add nodes, a sign note
and a floor node and I'll explain all of these.
A cosign node is simply just a cosign wave
that's going to be moving throughout the material
and we're adding two of them together.
Now the special thing about these cosign nodes
is that we currently have them set to a period
that is a random number.
This one's set to like 5 point with a
bunch of numbers.
This one's set to one point with a bunch of numbers
and our sign node is set the same.
Essentially what's happening here is that we're
creating a random fluctuation of a wave formation
to create a flickering effect and you can see our
flickering effect right here with this little
plane and it's turning on and off
at a random interval.
Now I'm going to create a time node.
To create a time node, you come up to your
material expression and you type Time and
I'm just going to click and drag him into the window.
You can move this guy around by holding control
on your keyboard and left click and
moving around with your mouse.
I'm also going to need cosign nodes and to
get to a cosign node, you can either type into
your material expression or I'm going to
right click and go to Math, New Cosign Node
and I'm going to plug this guy into here.
If we right click, excuse me, if we left click
mouse onto this little black box next to the
cosign, you can see that we're currently having
a flicker that's going at our normal pattern.
Just on and off with shades of gray in between.
If you click this guy, you can see that our period
is currently set to one and I'm going to set
this guy to something like five point 1-2-3-4-5-6.
The numbers that you input don't really matter.
It just matters that they're random and the
reason for that is that we want this to create
a random fluctuation in the time
when we add them together and we also don't
want this number to be too high, otherwise,
we'll have too long of a period
between light and dark.
We don't want that to happen.
I'm also going to just control C and control V
and create a second cosign node and I'm going
to make this guy 3 point 6-6-6-6-6-6-6-6, all right.
I'm going to add the time node into this.
The next thing I'm going to do is I'm going to
create an add node and to create a add node,
you can hold A on your keyboard and left mouse click
or you can type it into your material expressions
and the third way you can reach an add node
is to right click and go down to Utility,
excuse me, you go to Math, New Add.
We have an add node right here and I'm going
to plug these guys in.
If we look at our old expression, we also need a
second add node and a sign node.
Excuse me, click that back down.
I'm just going to control C and control V,
have an add node, going to plug this guy in here
and I'm going to right click and I'm going to
go to Math, New Sign.
I'm going to plug this guy in here.
Click and drag and I'm going to give this guy
a random interval of let's say, one point 5-7-5-7-5-7.
Sometimes I just like to play with the keyboard
and that gives me a change to
enter a random number.
All right, now we have our add node and if we
turn this guy on here and we plug him into
here, actually I'm going to grab all these guys
and I'm going to hold control and alt and
left mouse click so I can marquee select all
these guys and I'm going to move them up and
I'm just going to delete my old function here.
This guy off.
If we plug our add node currently into our
admissive channel, oh, we forgot to plug in
our time into the sign node.
There we go.,
You can see that we're having kind of like this
fading in and out and it looks all right,
but the thing is that lights don't really
fade in like that.
That looks more like a dimmer.
What we need is something that's going to
take the values and kind of push them more
towards the light or the dark.
What we need is a floor node.
I'm going to come up into our material expression
and I'm going to type Floor.
What a floor node does is it takes the value that
is being input into it and rounds them down to
the previous integer.
If you have something like zero point two,
it's going to round it to zero point zero.
It winds up creating more of a faceted effect.
I'm going to plug this in here and I'm going to
plug this into our admissive channel and
now you can see it kind of has this
random level of light.
Well, it's good.
Next thing I'm going to do is I'm going to
compile my material
and our material's compiled.
To be able to create the light function, we need
a dynamic light and you can see right now that this
is a dynamic light because we have
a D slash S for spotlight.
This is a dynamic spotlight.
It has a little chain right here because
this is a togglable light
which means you can turn it on and off.
You can also use it with movable lights if you
wanted to have a swinging light,
something like that, but I just want it to have
this toggling light on and off.
This ring right here is because
our lighting isn't built.
Once we have our lighting built, it'll look proper.
I'm going to delete this guy for just a second
and what I'm going to do is open up
our content browser.
Here we go.
I'm going to go to our Actor Classes and under
Spotlights, I'm going to grab a Spotlight Togglable
and I'm going to drag it into the scene.
I'm just going to close this guy
and here's our spotlight togglable.
Bring this guy right over here.
All right, and you can open up the properties
by either right clicking and
hitting Spotlight Properties
or just double-clicking on the light.
Now, I'm going to open up my light rollout
and open up Light Component.
Then once again, open up the Light Component,
Light Rollout, excuse me, and right now you can
see we have this function and it says none.
This is where we're going to plug
our light function into.
There's a little blue arrow and we're going to
click the blue arrow which is going to create a
new object and we're going to create a light function
and now we have the ability to roll all this out.
You see Source Material, None.
What we need to do is plug a material into
this function so we create our light.
We've created our light function material so let's
just open up our content browser and I'm going to
select M underscore Light Function and I'm
just going to click the
Use Selected Object in Content Browser.
Now that we have our light placed and our material
with our function placed inside of it,
we're going to build our lighting.
Now to do that, you just click the little
light bulb right up here and I'm going to turn it
for build quality production and this will
only take a second because this is a small scene.
Now that our lighting's finished being built,
you can see that we have a really cool
flickering light.
Now you can change this up a little bit by
changing the brightness or you could set it
to like five or something really bright and
change the color if you wanted to have
a demon light or a blue light for a rave.
You can have all sorts of different things that
you create these for.
I just decided I wanted to create something like a
little bit of a Silent Hill deal.
All right, well that concludes this lesson.
If you have any comments or questions about
materials covered in this lesson,
please don't hesitate to post on our forums.
Check out our other videos
and thanks for watching 3DMotive.com.