Home - Forums - Documentation - Gallery - Bugs
(Overlapping)
(Normals)
Line 112: Line 112:
==Normals==
==Normals==
-
There is no double-side surfaces. Every polygon has one side pointed by it's normal. Keep your normals in proper direction. If you need double side surface then just double and flip your polygons. In this case don't worry about previous rule Overlapping - polygons are perfectly opposite.
+
There is no double-sided surfaces. Every polygon has one side pointed by it's normal. Keep your normals pointing in the proper direction. If you need a double sided surface then just double and flip your polygons. In this case don't worry about the previous rule, the overlapping polygons are perfectly opposite.
{|
{|

Revision as of 04:07, 18 March 2007

Contents

Best Practices for Artists

Scale

Use proper and common scale for every model. Coordinate this with your coder. Usually 1 unit in your 3d program = 1 meter.

Center

Keep center of the object in the middle of the mesh or at bottom, not "somewhere". Remember that rotation and moving of the model is related to this point.

You can do it automatically by clicking the "Centre" button in Editing (F9) -> Mesh tab.

Transform

Moving, rotating and scaling is only for level making. If you are modelling a single object - do not use any transformations. Keep your object in neutral position and rotation. If you did any transformations, then use some option to apply it to the vertices positions.

Use Transfrom -> Clear/Apply -> Clear Location and Transfrom -> Clear/Apply -> Apply Scale/Rotation.

Direction

In the front view you should see the back of your model. (The CEL camera is specific, if you use this, main characters which use the camera should be facing toward you, then).

Naming

Do not use random names Object_031, mesh13_, blackblack_23_, 01_-_material_new2. Coordinate naming with your coder.

When working on multiple map files (between different people) make sure to coordinate names of mesh factories and materials so that you don't get duplicate names. Be careful about the default naming convention that Blender uses for mesh factories. If you don't change those you will have guaranteed conflicts when loading multiple maps at the same time.

Textures

Use png, it's compressed, it's lossless, and it has 8bit alpha.

Do not use jpg (except for textures that really don't require a lot of detail, but note that even in this case it is best to keep the source image as png because otherwise you loose quality everytime the texture is edited). Coordinate it with your coder, he will decide which textures should be lossy compressed, and which not.

Keep your textures hi-res until they are actually an issue, or you are going to release the game. In any case keep the hi-res versions somewhere, they are best in a source layered format like xcf or psd.

Also use textures that are a power of 2. For example 256x128 and not 256x130. In the latter case, CS will resize this texture internally, which sometimes can look rather ugly.

At release time, switch to DDS with dxt compression, I can't think of any case in which dxt5 is harmfull, it can handle layers/mipmaps, 8bit transparency, and more importantly, it's the same format as used by the graphics card, meaning textures load faster.

DDS compression types:

DXT1 opaque - compression ratio 8:1 - most popular for standard textures

DXT3 sharp alpha - compression ratio 4:1 - for textures with explicit alpha

DXT5 smooth alpha - compression ratio 4:1 - for textures with interpolated alpha

As of right now (march 2007), there is no graphics chip which can store a texture bigger than 4096x4096 (1024x8192 is not good). But don't worry about too big textures - if they don't fit in the graphics memory then CS will detect it and automatically downscale the texture.

You can have image.png and image.dds in the same folder, use the png for blender inthe viewport, at export time, b2cs will pick up the dds in order to use it in CS.
DDS plugin: gimp 1.2 (read only) and better one gimp 2.0.

Materials

Every per-pixel lighted material needs a normalmap. If you don't have a baked normalmap for your model, then at least use a fake plain normalmap (just a picture with the color 127, 127, 255).

Transparency

You can use two transparency modes:

1. Smooth variable alpha.

2. Binary mode full opaque/full transparent.

Binary mode is faster (use <alpha><binary/></alpha>). To tag transparent pixels you can use the transparency support in formats like png or keycolor. For keycolor, usually people are using "crazy pink" red=255 green=0 blue=255.

To avoid an ugly outline (halo effect) in transparent textures - use premultiplied alpha. Find this option in your 2d/3d program.

Transparent billboards should be rendered in per vertex light with a fixed renderstep. Also note that realtime shadows doesn't respect your alpha chanel, it will cast the whole mesh shape. Think about it before designing your game.

If you are rendering billboards with transparency use Scene (F10) -> "Premul" button.

Fitting

Generally when building larger levels you will want to build atomized objects so that the person compositing the levels can easily fit pieces together in the level editor. This means that each object should piece together nicely (often by being a discrete size) and the object centers should be appropriate too. Textures should also tile appropriately over the object.

Be aware of holes between objects and terrain. In objects like a tree/house etc. it's a good idea to prepare an extended bottom about 0.5 m under the ground line.

To make a tilable texture use the bulit-in "Make seamless" or better Resynthesizer plugin.

Speed

10 objects with 10000 polygons for each - is faster than 10000 objects with 10 polygons each. The same thing applies with materials. For one object, use one big texture with many unwrapped faces, it's better than a couple of textures. Of course sometimes it's impossible because you need one shader effect for glass and another for a car body, for example.

Overlapping

Avoid overlapping faces. In realtime rendering it makes an ugly flickering effect called "z-fighting". Instead of intersections, it's better to add a couple of connecting faces between surfaces.

Normals

There is no double-sided surfaces. Every polygon has one side pointed by it's normal. Keep your normals pointing in the proper direction. If you need a double sided surface then just double and flip your polygons. In this case don't worry about the previous rule, the overlapping polygons are perfectly opposite.

You can double your faces automatically by setting Render -> Twosided.

Triangle fans

Avoid of triangle fans and thin polygons. It looks ugly in realtime rendering. Perfect shape should be close to grid.

You can try automatically reorganize your faces to optimal using Edit -> Faces -> Beautify fill (ALT, F).

Holes

Sometimes because of optimization reasons obejcts needs to be closed. Some shaders (real time shadows with normal maps and everything) also require closed objects to render properly. Coordinate closing objects with your coder.

Smooth groups

If you need visible seam on your mesh then split polygon's vertices. But if not needed - don't double your vertices.

To split vertex to two use Edit -> Vertices -> Rip (VKEY). To clean doubled vertices use Edit -> Vertices -> Remove Doubles (W, 5).

Terrain

Terrain ignores your uv's. They are internally generated by engine. Basemap and Materialmap just fully covers terrain mesh, and for Splats uv's makes regular grid, scale of this grid is set in shader variable.

If you made terrain mesh and generated heightmap then result in the game always will be a little bit different than your orginal mesh, especially at hill-side. Also check bounds of your Heightmap, sometimes it has unneded holes.

Heightmap encoding is: red * 65536 + green * 256 + blue

Use the foliage plugin to make grass, it can use a material map to choose where the grass, tree, rocks will be. Use a material map to chose which texture will be displayed on the ground, at which place, in such case, more than 4-5 textures will probably kill your framerate.

You can easily make your Materialmap by reduce your Basemap's colors to number of Splats.

b2cs automatically renders heightmap basing on mesh tagged as 'terrain'.

Format

For geometry Crystal Space uses own fileformat and a couple of popular formats: 3ds, cal3d, md2. If you want use 100% of features better use native CS format. Actually best supported is exporting from Blender. If you work in team and members using several 3d programs - exchange models between them in any popular format like Collada or Wavefront Obj.

If often switching apps, .obj may be the best option, it s very simple, supported in most apps, and has Ngone support. Collada is xml based and support a lot of things as a downside it is difficult to write parser for it and as it s quite recent, not yet all apps have support for it, however at a later pointit is supposed to be _the_ interchnage format.

Collada plugin is built-in.
Collada plugin: www.feelingsoftware.com.

Authors

Darek, Genjix, Jorrit, Orogor

| Article | Discussion | View source | History |