|Line 125:||Line 125:|
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.
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. closing objects with your coder.
Revision as of 23:04, 17 March 2007
Best Practices for Artists
Use proper and common scale for every model. Coordinate this with your coder. Usually 1 unit in your 3d program = 1 meter.
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 "Centre" button in Editing (F9) -> Mesh tab.|
Moving, rotating and scalling is only for level making. If you modelling single object - do not use any transforms. Keep your object in neutral position and rotation. If you did any transform then use some option to apply it to vertices positions.
|Use Transfrom -> Clear/Apply -> Clear Location and Transfrom -> Clear/Apply -> Apply Scale/Rotation.|
In front view you should see back of your model. (CEL camera is specific, if you use this then main characters which use camera should be faced to you then).
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.|
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.|
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).
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 just transparency support in formats like png or keycolor. For keycolor usually people using "crazy pink" red=255 green=0 blue=255.
To avoid ugly outline (halo effect) in transparent textures - use premultipled alpha. Find this option in your 2d/3d program.
Transparent billboards should be rendered in per vertex light fixed renderstep. Also note that realtime shadows doesn't respect your alpha chanel, it will cast whole mesh shape. Think about it before designing game.
|If you rendering billboards with transparency use Scene (F10) -> "Premul" button.|
Generally when building larger levels you will want to build atomised 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.
To aware holes between objects and terrain. In objects like a tree/house etc. it's good idea to prepare extended bottom about 0.5 m under ground line.
|To make tilable texture use bulit-in "Make seamless" or better Resynthesizer plugin.|
10 objects with 10000 polygons for each - are faster than 10000 objects with 10 polygons each. Same thing with materials. For one object use one big texture with many unwrapped faces, it's better than a couple of textures. Ofcourse sometimes it's impossible because you need other shader effect for glass and other for car body for example.
Avoid of overlapped faces. In realtime rendering it makes ugly flickering effect called "z-fighting". Instead of intersections, better add a couple of connecting faces between surfaces.
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.
|You can double your faces automatically by setting Render -> Twosided.|
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).|
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.
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 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'.|
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.|
Darek, Genjix, Jorrit, Orogor