okay welcome back I'm Alex wood and this
is Ed Mackey from both from analytical
graphics and we're here to talk about
jail continue our video series on gltf
authoring from end to end so starting
from model geometry creation through
material generation and with an end goal
of having a gltf model that we can use
everywhere so in the last video we
authored we downloaded a texture set
from CG CC 0 textures yes
com and it's a nice little solar cell
texture set bad metallic roughness base
color textures and we applied that to
our solar cells they look much better
now we threw out the placeholder
material that we had from an earlier
episode and had what are we gonna do
today well today we're gonna create a UV
atlas so we have we in in the last video
we did this downloading the image and
then creating the UVs to match the image
and this time we're gonna do it the
other way around we're gonna create a UV
Atlas with no image and then we're gonna
start baking into that Atlas if you
already know how to create a UV Atlas
you can skip this video on to the next
video where we'll talk about using that
UV Alice that we built to bake a
procedural texture map of some brushed
aluminum with with fractal 3d noise in
it that's exciting
yes yes but UV maps are also exciting
yeah not really
UV maps honestly are a little bit of a
chore but they're an important thing to
get right this is a leftover texture
from a previous video I'm gonna hit this
X button to clear it out so you just
jumped over to the UV editing yes I am
in I'm still in blender 2.81 a and I've
loaded the project from the previous
video and I've jumped over to the UV
editing tab and the tab always comes up
in edit mode I'm gonna hit hit tab to
switch to object mode I need to make
some changes here to the number of
objects I have selected first of all I
don't want to affect what we did in the
previous video with these solar panels
so I'm actually gonna hold shift and
click the eyeball on the CubeSat and
make the whole thing go away that not
just the the parent object but all the
child objects and now I'm just going to
regular click
the eyeball and we see coming back we
see just the cubesat body with just some
placeholder materials on it and I am
also going to need flap one there are
four flaps on this CubeSat and in if you
recall if you recall from previous
videos they are all instances of the
first one so we really only need to
apply a text ring to one of the four
flaps and it will get automatically
copied around to the rest so these two
objects I'm going to multi select them
and hit tab to edit them and hey to
select all we are gonna create a UV
atlas for this now you'll notice there
are some UV coordinates that are already
here they they're just sort of naturally
here as part of the construction process
of the model blender may have tried to
automatically assign some here and there
along the way I'm gonna get rid of them
all yeah I see a lot of geometry stacked
on top of each other there yes yes and
when you're baking a material you cannot
have the sort of UVs stacked on top of
each other like this that's one of the
advantages actually with going the other
way with starting with the image then
you can have all the overlap you want
you can have UV sticking off the edge
wrapping around but when we're baking
we're constrained to bake within the
confines of the image with no overlaps
so let's hit the U key I'm gonna start
by doing the most naive thing possible
ask blender to be smart for me we'll see
how well that works I'm gonna tell it
though to use an island margin of 0.02
this the the UV atlas is broken up into
these islands and i like to give them a
little gap and I also like to tell it to
not stretch these things I would
sometimes I stretch them manually but I
don't want blender to pre stretch them
so I hit okay on that blender takes its
best swing it looks pretty smart to me
how can we I mean can we do better I
think we can do a little better than
this one of the not so smart things is
there's a lot of empty space up here at
the top which I don't like those are all
wasted texture pixels that will be
filling up your GPU memory but not
contributing to your model on the screen
and the other thing I don't like about
what it did is that I've actually got
two different materials on here
I've got a metal frame material and I
have a yellow circuit board material and
it's sort of jumbled them together I
would like to separate this so I'm gonna
hit alt a to deselect I'm gonna select
these materials one at a time starting
with the circuit board and I'm gonna
separately unwrap my individual
materials and this is a technique I've
been using on a couple of models I built
where I unwrap one material I hit select
all and I just shove it off to the side
we select the second material and you
see that before I unwrap the second
material you see from our original
unwrapping we have some of the material
over here and somewhere there and then
we have a gap where there was some other
material in between that's what I don't
like about the automated unwrapping so
I'm unwrapping one material at a time
this has advantages and disadvantages
one of the disadvantages is you you're
not guaranteed the same scale you know
each material ends up filling up the
whole atlas and then it's up to you to
sort of get the scaling mostly correct
so to do this next part I'm gonna hit
this little button here is called UV
island selection mode and that lets me
hit a single vertex and just move an
entire UV island out of the way I want
to take this big column in the middle
and shove it to the left and there's
some little blocks here the I think
these are the tops and bottoms of the
feet of the CubeSat I'm gonna hit ctrl L
to grab that last foot and slide it out
of the way and I want to get this all
sort of pushed over to the side and
you'll notice the unwrapping got it very
very close to the top and bottom so I
don't want to just sloppily move it I
want to constrain it on the x-axis like
that and slide it over let's actually
zoom in and see how well I did
slide it even a little further so we we
pretty effectively have this sort of
left third of the image filled in and
then these little guys I think I can
find a spot for them just by rotating
them
and it be careful I've loaded a project
from a previous video here and when I
hit rotate they all go crazy so we we
had been on the solar cells we had been
using individual origins I'm going back
to the default behavior of bounding box
and now I can rotate the whole thing
type the number 90 hit enter slide that
in there and this is part of the beauty
of creating the UV atlas before you
create the image it doesn't really
matter where I place this it could be
over here over there when you do the
baking process it's it's going to take
the texture that you've assigned and try
and bake it to that spot in in the
resulting image map I'm gonna take these
last two things and zoom in and sort of
make them a little neater and tighter
make as much room in case later on I
decided to come back here and add more
geometry because there's not a whole lot
of geometry and now I can hit select all
and find my missing circuit boards I'm
gonna rotate them 90 and they're too big
to fit and we just scale them down I
don't want to scale them too much but I
want them to fit so I'm going to get
them to fit just like that and and at
this point I realize I've gotten extra
space on the sides I could if I wanted
to scale them a little bit this way this
gives them a few extra pixels of the
texture map but at the expense of the
pixels won't be perfectly square they'll
be slightly rectangular which may not be
a bad thing for this this particular
piece I'm doing so so what we have right
now then is we have two separate
materials that are providing UV
coordinates in a single texture space
yes and the advantage of that is at some
future point we may end up deciding to
merge these two materials into one and
the question of whether and how to merge
materials is an interesting question so
let's talk for a minute about what is a
material
an artist thinks the material is is wood
or metal or mud or what have you and the
graphics engine thinks it's something
very different the graphics engine
thinks the material is the shader
program which in this case is a PBR
shader and a stack of texture maps and
so we have these two material slots and
each polygon either belongs to one
material or the other and that's not
always good enough for a complex object
you might want something made of metal
that has a bunch of mud splattered onto
it so you have individual pixels that
are covered by mud and other pixels that
are metallic so you may want to use a
single material for both the mud and the
metal as different materials though they
may seem to you you want a single
material slot a single shader stack a
single texture stack controlling that
and that's one of the things that this
workflow allows that that may be
downloading pre-baked images doesn't
allow so much except in the case of our
solar panels we had sort of dirt and
smudges baked into them from that from
the outset but we we didn't get to blend
them per pixel into any of our materials
going that route where's yeah well and
so to further that point there right we
have the model will only have one
texture for metal roughness for these
two pieces of geometry so they're
sharing that one that mean that's that's
only one texture to load only one
texture to find it when you're rendering
the the actual geometry and a rendering
engine so the more we can combine these
into unified textures and then as you
suggested you know we could even take a
more aggressive step and merge the
materials and do a singer' material we
won't do that right now but just the
fact of putting these into a single
texture is already giving us a little
bit of a it's giving us some Headroom to
do that in the future absolutely that
may even say end up saving our graphics
engines and some draw calls and text
turbines and other technical stuff like
that so so that is our quickie UV atlas
and in the next video we are going to
apply a three dimensional noise texture
map and try and get some brushed
aluminum on to our UV atlas see how that
works
you