Subject: [Nel] Landscape generation pipeline

From: "Cyril 'Hulud' Corvazier" <[email-masked]>
Date: Fri, 19 Oct 2001 20:35:20 +0200

Hi there,

Here is a small guideline to generate landscape for NeL:

The landscape is done in 2 steps:

First step : artist creation of landscape data (textures and geometry)
Second step : offline processing of final data

1) ----- Creation process

a)  Draw some tiles

Tiles are textures that will be applied on the landscape. Tiles size can be
128x128 or 256x256.
A 128x128 tile will be used to map a 2x2 meter aera.
They are 24bits TGA files.
Tiles are grouped by tileset. Contraints for tiles in the same tileset:
-> The up and down pixel border of tiles must be the same.
-> The left and right pixel border of tiles must be the same.

You will need some 8 bits TGA textures to make smooth transitions between
tileset. This special "transition tiles"
are 128x128. To complete all possible transitions you need 48 alpha
textures. In fact, only 12 are needed
with some rotations.

You will need displacement tiles too. Displacement tiles are like bump maps.
They are 8 bits TGA file of 32x32 pixels.
Each tileset can have 16 differents displacement tiles.

To know more about how to draw your texture tiles and alpha tiles, check the
following document:

/download/examples/tile_bank.doc (330 ko)

b) Build a tilebank file

The tilebank file is edited with tile_edit.exe. The project is
cvs/code/nel/tools/3d/tile_edit

- You will setup your tilesets by listing your bitmaps. Note that pixel
checks are made at this step to check constraints describle above.
- You have to list your transition textures. There is a button "batch load"
to load all your transition tiles in one time if the file name
is normalized ( alpha_trans_00.tga alpha_trans_01.tga where the number
follow the convention gived in tile_bank.doc).
- You have to list your displacement tiles too.
- You have to define one or several land. A land is a set of tileset.

Here is snowballs's tilebank with its textures (i have added some bumpy
displacement map) :

/download/examples/tilebank.zip (3 Mo)

Don't forget to change the absolute path of the bank in tile_edit. Or you
will not be able to see the texture in the tool.

At the question  "What the tile set's children are for ?" the answer is :
nothing, it is obsolete :)

c) Build the zones geometry

Ok, now we have to build some geometry for our landscape.

As you probably know, NeL landscape is based on Bezier quad patches.
Bezier patches are more flexable than height field. you can make creases,
concave elevations, holes etc..
Bezier patches are edited in 3dsmax using editpatch.
The landscape is divided in zones. A zone is an area of 160x160 meters. Each
zone is a patch mesh of 3dsmax.
The vertices at the boundary of the zone must be snapped. They will be
welded in the post process.

The zone name is like: 3_aa.zone
The name is composed of a numeric coordiante (NUM = 3) and a alpha one
(ALPHA = aa = 0)
The upper left corner of the zone coordinate is :
X = 160 * ALPHA
Y = 160 * - NUM

For examples, a snowball zone is called 4_ac.zone, it means its upper left
coordinates are ( 320, -480 )

d) Paint the zone with tiles

A patch is composed 16x16 tiles. Tiles are our 128x128 textures. A 256x256
textures is 2x2 tiles.

Once you have modeled your zones, you will have to paint it with textures
and colors.

Before painting, you must set the bank you want to use it in 3dsmax. To do
so, use the utility plugin
called "NeL Tile Bank". Choose your bank on your hard disk. (Don't forget to
set the absolute path
of the bank in tile_edit). No need to "Setup material". If you do this, the
plugin will generate a material
per tile and try to map patches with it. When your bank become big, this
take a lot of resources.

Now convert your patch mesh using the "NeL convert" modifer. Now your object
is a NeL patch mesh and
not a patch mesh. Now add a painter modifier. You can paint.

You can paint over several patch meshes by adding a paint modfier over
several NeL patch meshes.

Now you should see the patch painter in a NeL window. Main commands are:

F1: Tile mode, paint textures
F2: Color mode, paint vertex color
F3: Displace mode, paint displace textures
A: automatic lighting on / off.(to see the displacement, a little slow)
SPACE: choose your texture, colors or displace to paint.

etc...

See cvs\code\nel\tools\3d\plugin_max\nel_patch_paint\user_guide.txt for
other commands.
You can configure it by editing the keys.cfg file.

Check some snowballs zones max project:
/download/examples/snowballs_zones.zip (1 Mo)

Note that to do that kind of work, you need a modifier you don't have : edit
patch for NeL patch meshes. The reason
is it is based on Discreet source code. With nomal edit patch you can
subdivide patches, extrude, bievel etc.. You can't for example, change the
number of tiles on a patch.

e) Performance issues

Some notes about performances:

- You can make a lot of zone. I can't tell you the zone count for our
project, but it is high :)
- 700 128x128 textures is a good count. (Use DXTC5 !)
- 50 patches of 16x16 tiles per zone is the max peek you should use.
Equivalent to 200 patches of 8x8 tiles.
- A tile should be 2x2 meters on the ground. It give you 1.5 centimeter
pixel ratio. Double than quake 3 walls but on a landscape ! So with the
given patch count, you have twice the surface of the zone to model it.

Now your zones are modeled, painted, colored and displaced. Time for
processing.

1) ----- Offline process--

The offline processing project is in cvs in

cvs/code/nel/tools/3d/landscape_builder

How to build the NeL landscape.

a) What does mean 'Build the NeL lanscape' ?

Once you have created your tile bank and your landscape zones, you will need
to preprocess your zone
in order to:

- Weld the boundary vertices of the zones
- Light the zones with shadows casted by the landscape and the static
objects (like trees, buildings..)

b) Requirement

Before building the landscape you must have:

- Installed Cygwin tools and set the PATH properly. (Under windows)
- Compilated some binaries and putted them in the "bin/" folder.
(zone_dependencies.exe, zone_welder.exe, zone_lighter.exe. zone_smoother.exe
is not use anymore)

c) Data exportation

You have to export those data:

- The .zone files in the "zone_exported/" folder. (NeL landscape zone files
exported from 3dsmax)
- The .bank file in the "bank/" folder. (NeL bank edited with tileedit)
- The .ig files (named like the zone) in the folder "ig/". (NeL instance
group file exported from max)
- The .shape files (for trees, building or every things that cast shadows on
the landscape) in the folder "shaped/"
- The .tga files (for the shapes used for alpha blending and for displace
tiles) in the folder "maps/"

d) Configure

Configure the cfg/properties.cfg file.

e) Computing

* 0_clean_all.bat - clean all the directories.

* 1_build_dependencies.bat - build dependencies files. Each zone will have a
dependency file in which is listed the zone that cast shadow on it. ->
generate the .depend file in the folder zone_depend/

* 2_weld.bat - Weld the zones. -> generates the .zonew files in the folder
zone_welded/

* 3_light.bat - Light the zones. -> generates the .zonel files in the folder
zone_lighted/

All the building process in incremental, ie, if you modify only ONE .zone
file, the weld pass will modify the zonew file and each neighbors of this
zone. The light pass will relight only the .zonew modified files.

The .zonel files are the final zone files. They are loaded by the engine.
(see snowballs 2 source code for detail).

f) farbank building

You will need to compute a farbank. The farbank is the bank used to map the
patches when they are far.
This bank is computed with the .bank file and the tiles texture. see the
project:
cvs/code/nel/tools/3d/build_far_bank

---

I hope this first document will help you. All the Nevrax team is ready to
reply to your questions and comments.

Regards,

Cyril Corvazier
---
Lead 3d programmer
Nevrax France

---

From: "EagleEye" <[email-masked]>
Date: Fri, 19 Oct 2001 15:07:18 -0500

> coordinates are ( 320, -480 )

By your example, aa = 0, so ab = 1?  ac = 2 then... so that makes sense...
but where does it end?  az?  Or is it more like hex, where it goes to af? :)
Does the progression go like:

aa = 0 to az = 25,
ba = 26... bz = 51,
ca... etc

all the way to zz, which would be a total possible number of combinations of
26^2?

The math is wrong on the example too... 160 * -4 = -640, not -480... or am I
missing something there?

---

From: "EagleEye" <[email-masked]>
Date: Fri, 19 Oct 2001 15:13:13 -0500

> objects (like trees, buildings..)

What if I want to make trees in my world dynamic objects?  If I just make
the landscape and preprocess it without trees, but add the trees later as
dynamic objects, they'll still have the shadows and stuff done right,
correct?  Granted, more processing required on the client (I would guess),
but it would allow for some key elements of my game (the actual cutting down
of trees and dynamic structure building for example).

---

From: "Anatoly Sennov" <[email-masked]>
Date: Sun, 21 Oct 2001 00:31:15 +0400

Hello Cyril,

> reply to your questions and comments.

Big thanks, I'll try to catch up :-)

--AS