1 Tutorials LightWave 3D Quick Terrain for Games 2 Qua Jan 26, 2011 1:55 am
Admin
Admin
UV Mapping the Image Onto
the Surface
Are you starting to get ideas? Can you think
of other ways to use this procedure? Let me
tell you, there are dozens of different scenarios
where this basic procedure can dramatically
speed up your productivity. I keep a folder
full of gradient ramp images (NorthSouth, EastWest,
Radial, Radial Square, etc.) for quick and
precise weight-map projections using Texture
VMap.
If the UV-mapped image seems to stretch unacceptably
in certain spots, go back into Modeler and simply
select the offending points for those areas.
The points will also become highlighted in your
UV Texture viewport. You can then massage their
position on the UV grid to alleviate the stretching.
Remember too, that we used a simple flat subdivided
plane with even divisions across the entire object.
Better results could be achieved by using the
terrain as a background image and repositioning
the points to conform to the shape of the road
and cliffside. (For even more precision, you
could create the plane from scratch.)
Projecting Vertex Colors
Figure 12
Not a bad approximation, eh? Just think, in
the games world where texture space is
a scarce commodity, this terrain is fully colored,
with a fair amount of texture detail, and it
uses no image maps! Now that's efficiency. You
can always increase the polygon count in areas
where you need more detail.
Alternatively, you could UV map a color texture
onto specific surface areas where you need a
more realistic-looking surface. For the road,
you might UV map a tile-able road image on that
part of the terrain.
The design might also call for a tunnel, which
you can easily create in another layer and use
it to do a Boolean subtract on the cliff.
A Boolean operation?! "That would completely
destroy my UVs," you say, and you would
be absolutely right, if you were using any other
3D package. But fortunately, you're using LightWave,
where UVs are handled so elegantly that you can
cut, slice, hack, and otherwise mangle your UV
textured objects to your heart's content. LightWave will
not only keep your original UVs intact, but will
also add more to geometry that is shifted or
beveled out from the existing model! In fact,
the ability to completely unweld an object and
merge the points back together later without
a hiccup in the UV mapping is used to great advantage.
But that is, unfortunately, a tutorial for another
time.
We have only scratched the surface of the possibilities
with these simple case ideas. However, it is
on these very basics that game content is built
upon, enhanced to fit virtually any design and
delivered with tremendous efficiency using LightWave
3D. Having so much power, so accessible,
is the very reason why LightWave will be
leading the way in the evolution of not only
quality look and feel, but in the entire game
development process.
Color terrain
image
Grayscale
terrain
Terrain LightWave object]
the Surface
- Now open the Surface Editor and make sure
the Terrain surface is selected. Click the Color attribute's Texture
button to add a texture to your terrain.
The Texture Editor offers you abundant options
for total control over your surfaces (truly
powerful stuff!). The default Layer Type is Image
Map, which is what we want, so leave all
the settings the way they are. - Select UV from the Projection pop-up
menu. Next, select the TerrainUV map from the UVMap pop-up
menu.
Since we don't have an image loaded yet, choose (load
image) from the Image pop-up menu.
Load the color texture image using the file
dialog that appears. The image should appear
in the preview window. - Set the Width Tile and Height
Tile to Reset. - Since you are using UV mapping, all of the
texture positioning work is done. Click Use
Texture to close the panel. You can close
the Surface Editor now as well.
If you had used Planer for Projection (instead of UV), you would need to also make sure Texture Axis is set to Y. You would also need to click Automatic Sizing to let LighWave figure out how to fit the texture exactly to the size of your surface. |
- Make sure the Rendering Style of your
Perspective viewport is set to Texture (you
can select this from the viewport's titlebar),
so you can see your object textured in all
its glory! You might want to set your Texture
Resolution (Display Options panel, Layout
tab) to 512 to see the nicest display
possible. (Figure
Figure 8
Applying a Magic Face Lift
So you're looking at your terrain and saying, "yeah,
but it's flat!, and that's a lot of polys to
try to lift and conform to that terrain texture." Well,
rest your weary head my friend, we're moving
on to the magic.
As we discussed earlier, the little W button
in the bottom-right corner of Modeler's interface
stands for weight maps. LightWave can
make extensive use of these maps. You can apply
them to points in many ways, including painting them
on with the Airbrush tool.
These maps are sometimes used to control the
amount of influence a bone has on an object.
But another way to use weight maps can go unnoticed.
Many of the modify tools let you use a weight
map for the tool's falloff! (see Figure 9)
Figure 9
A weight map transforms a tool as simple as
the Move tool into a multi-variable point
displacement device ! (In layman's terms:
the Move tool set with a weight map falloff moves
the object points at different strengths, based
on the weight value for each point.) A point
with a 100% weight (colored red in a viewport
set to the Weight Shade rendering style)
would move with the Move tool 100%, while a point
with a 50% weight would lag and be affected only
half as much.
With the Airbrush tool (Map > Airbrush),
you could actually spray the values onto
the points to control the modification amount
that you want. This is a good tool for freeform
application of weights and vertex colors, but
in our case, we want more precise control over
the application of our weights. Enter the Texture
VMap command.
Basically, Texture VMap lets you texture your
object's weights or vertex colors using the standard
Texture Editor. You can use all of the images,
procedurals, and gradients your little heart
desires. How cool is that?! - Go ahead and choose Map > Weight & Color: More > Texture
VMap.
The VMap Type pop-up menu lets you texture
either a weight, morph target, or vertex color
map. Choose Weight Map and enter "Terrain
Weight" into the VMap Name field. - Click the Texture button at the bottom
of the panel to open the Texture Editor. The Layer
Type will be Image Map, which is
what we want. Since this is a straight-down
projection, set the Projection to Planer.
Select (load image) from the Image pop-up
menu and load your grayscale terrain image.
It should show up in the preview window. - Set Width Tile and Height Tile to Reset and
turn off Pixel Blending and Texture
Antialiasing—this is important because
any blurring of the image will cause unwanted
falloff around the edges of your object. - Select Y as the Texture Axis for
mapping and click Automatic Sizing to
perfectly size the texture to your surface.
Now, simply close the Texture Editor by clicking
on the little "x" in the top right corner.
Also close the Texture VMap panel. - Now, to check that everything is kosher,
switch your perspective viewport to the Weight
Shade Rendering Style. You should see the
variations of weight values across the surface
of your object matching the terrain. (Figure
10)
Figure 10 - We'll use this weight map to control the
Move tool with great precision. Make sure you're
in the Point edit mode. Choose Modify > Move and
open the Numerics panel by pressing the n key.
Set the Falloff mode to Weight Map. - Place your mousepointer in the Back viewport
and hold the Ctrl key to constrain your movement
to one axis. Click and drag up until you've
moved points 40m in the Y axis. (Watch the
info display in the bottom-left corner to see
when Y=40.)
Now take a look at that! Your points were modified
by the Move tool based on their weight (your
precise grayscale image) to form a perfect
fit for your terrain. Check it out by switching
your perspective viewport back to the Texture Rendering
Style.
Look at how the texture drapes perfectly over
your texture, and how the road rests nicely
on the flat area you specifically painted into
your grayscale image for that very purpose.
See how the cliffside juts out of the water.
(I added slight waves in the my grayscale image.
Notice how they conform to the contours of
the winding cliffs.) Nice. (Figure 11)
Figure 11. Turned 90 degrees
Are you starting to get ideas? Can you think
of other ways to use this procedure? Let me
tell you, there are dozens of different scenarios
where this basic procedure can dramatically
speed up your productivity. I keep a folder
full of gradient ramp images (NorthSouth, EastWest,
Radial, Radial Square, etc.) for quick and
precise weight-map projections using Texture
VMap.
If the UV-mapped image seems to stretch unacceptably
in certain spots, go back into Modeler and simply
select the offending points for those areas.
The points will also become highlighted in your
UV Texture viewport. You can then massage their
position on the UV grid to alleviate the stretching.
Remember too, that we used a simple flat subdivided
plane with even divisions across the entire object.
Better results could be achieved by using the
terrain as a background image and repositioning
the points to conform to the shape of the road
and cliffside. (For even more precision, you
could create the plane from scratch.)
Projecting Vertex Colors
- Try this just for fun. Go back into Texture
VMap, but this time select Vertex Color as
the VMap Type. Name it "Terrain Vcolor." - Open the Texture Editor and apply the same
settings as before (using Planer Projection),
but load your color terrain image into the Image pop-up
menu. Close the panels. - Open the Surface Editor and go to the Advanced
tab. On the Vertex Color Map pop-up menu, select
the Terrain Vcolor map that you just created. - Back on the Basic Tab, click the Color attribute's Texture
button. Uncheck the image map layer in the
layer list to temporarily disable the UV map
texture. Click on Use Texture to close the
Texture Editor. - On the Surface Editor's Basic tab, change Luminosity to
100% and Diffuse to 0%. This lights
the surface using only its own vertex colors.
Close the Surface panel and look at your Terrain
now in the perspective view.
Figure 12
Not a bad approximation, eh? Just think, in
the games world where texture space is
a scarce commodity, this terrain is fully colored,
with a fair amount of texture detail, and it
uses no image maps! Now that's efficiency. You
can always increase the polygon count in areas
where you need more detail.
Alternatively, you could UV map a color texture
onto specific surface areas where you need a
more realistic-looking surface. For the road,
you might UV map a tile-able road image on that
part of the terrain.
The design might also call for a tunnel, which
you can easily create in another layer and use
it to do a Boolean subtract on the cliff.
A Boolean operation?! "That would completely
destroy my UVs," you say, and you would
be absolutely right, if you were using any other
3D package. But fortunately, you're using LightWave,
where UVs are handled so elegantly that you can
cut, slice, hack, and otherwise mangle your UV
textured objects to your heart's content. LightWave will
not only keep your original UVs intact, but will
also add more to geometry that is shifted or
beveled out from the existing model! In fact,
the ability to completely unweld an object and
merge the points back together later without
a hiccup in the UV mapping is used to great advantage.
But that is, unfortunately, a tutorial for another
time.
We have only scratched the surface of the possibilities
with these simple case ideas. However, it is
on these very basics that game content is built
upon, enhanced to fit virtually any design and
delivered with tremendous efficiency using LightWave
3D. Having so much power, so accessible,
is the very reason why LightWave will be
leading the way in the evolution of not only
quality look and feel, but in the entire game
development process.
Color terrain
image
Grayscale
terrain
Terrain LightWave object]