Voxel — it is formed of words: volume and pixel — element of volume image containing value of an element of a raster in three-dimensional space. Voxels are analogs of pixels for three-dimensional space.
Voxels for a long time are used in computer games, however their use restrictedly because of serious requirements to hardware. More often in games voxels are used for display models. Are sometimes used voxeled landscapes instead of a usual field of heights is allows to create more difficult spaces with caves and bridges. One of most important possibilities voxel landscapes, interiors and objects is possibility of their dynamic change, and destruction in real time. In Build Engine games there is use possibility voxel objects.
To create and add voxel model, following set of programs is required to us:
• POLY2VOX – Converter of polygonal models in voxel, is written by Ken. Supported formats of three-dimensional models: *.ASC, *.3DS, *.MD3, *.MD2. There is an source code.
• SLAB6 – Editor from Ken Silverman. Allows to create, edit and save voxel models in some formats. It is better to download the latest version as in it function of change size of models has been added important for us. In this article drawing in the given editor - it very long won't be considered, inconveniently, and as a result it turns out isn't realistic. It is much better to use high-grade 3D editors (3d Studio Max, Blender etc.), however SLAB6 it is necessary for saving to correct format and appointments of the necessary palette for voxel.
• EDITART – All known program for addition new sprites in *.ART files.
• ARTEDIT – It is required to us to appoint voxel the identifier added sprite.
• BARF – It is necessary for model addition in resource archive of game.
CREATING VOXEL MODEL
Stage 1. Converting
For example I will use advance prepared simple polygonal model of a box which can be downloaded in head "In addition". If you want to use another, but never worked in 3D editors, I can advise project resources «Transfusion». Files *.PK3 can be opened by means of archiver WinRar.
• Move model and skin to one folder with the converter. It is important, that skin was in one folder with model, otherwise you receive white cubic.
• Open file *.3DS by means of POLY2VOX and wait the operation end.
If all of you have made correctly, after converting in the same folder there will be file with expansion *.KVX this is voxel model but before to add in game, it is necessary for us to edit it.
Stage 2. Editing
Start SLAB6, choose the menu «File», click point «Open» and choose your *.KVX model. Most likely, you will see a huge box which closes all kind.
The matter is that all polygonal models are by default converted with maximum grid, therefore width,height and their volume always will be 128x128x256 (max size of model in Build Engine) that not desirable, if we draw small objects.
If to reduce it in MAPEDIT – freezings of game and disappearance of models directly before a nose at the player are inevitable. Even worse when Blood will start to take off with message "Out of memory!".
Here it is better to use function «Halve Dimensions» (tab Tools) that allows to reduce it in 2 times.
At too strong reduction at difficult models quality can suffer, therefore I consider as optimum width\height of model – 64x64 and 32x32[/color], and then if model seems to you big, it can be reduced manually in MAPEDIT is guaranteed will allow to save memory of game and not too will worsen quality.
Huge polygonal models, for example, cars at converting also will be reduced to 128x128x256 that will lead to the big loss of quality. Actually instead of the smoothed car, you will see pixels and cubes as voxel model doesn't use texures, and paints each pixel in the color. Therefore it is not necessary to use too big objects, or in advance to divide convertible model into some parts in 3D editor.
Change of colors of palette will be following step at the given stage. It is better not to forget about this function, differently you will see " gray-green-yellow-red" cube in game without any pattern, or than that is worse – Blood in general will refuse to be started.
Click a tab «Tools» and choose point «Replace palette and convert colors». Before you there will be a dialogue window in which it will be offered to you to choose palette. As palette the screenshot or the model taken from Blood can serve. As file PALETTE.DAT can be it, which all the same is required you to work in EDITART – it I and I suggest to use as palette for our box. After you have changed palette, the background becomes gray is means that the palette has been successfully replaced on chosen by you. Now, to see, how the model will be displayed in game, it is necessary to click a tab «View» and to clean daw from point «Normal Shading». Unfortunately, SLAB6 doesn't keep settings, therefore to clean daw it is necessary each time anew as soon you restart the program.
We approach to final step of editing – creation sprite for game. The picture which will be displayed in MAPEDIT is necessary for any model, or in game if to reduce detailed elaboration level. Sprite it is desirable to make same size, as model that in game your objects weren't groundless, or have been on the contrary pressed in the earth. Again click tab «Tools» and press point «Adjust Pivots». In left bottom corner there will be three windows «Z:?: \??», «Y:? \??» and «X:? \??», where «?» means exact size of model in game. Us last two values interest – they define width and height of ours sprite. For box I used values 64, but you are limited only by your imagination and possibilities of editor. Create sprite same size (it is possible to make a screenshot directly in editor) and save it in format *.GIF. It is absolutely unessential to process it in a photoshop, after all instead of sprite in game the model but if don't want will be displayed that players were terrified, when will reduce detailed elaboration or will play with 3DFX a patch which doesn't support voxels – I recommend to read other article on addition sprites in game.
Stage 3. Saving
Click menu «File» and choose «Save As», choose a format *.KVX and enter name, for example «box01.kvx». There will be following window in which it is necessary to choose «5 mips» is will increase the size of file, but will make model suitable for use in Blood.
On it model creation is finished, the most difficult behind and it is possible to lean back on a sitting back, and move model and sprite to folder with Blood is better.
ADDING MODEL IN GAME
Stage 1. Adding sprite
Start EDITART, move in any free tile and press «Enter». Now press «U» and move the index to yours *.GIF file then press key «O». Sprite should be added and be in size 64x64 if isn't present – you can easily change its size, having pressed key «S» and having entered values. As I have already told – absolutely unessentially that sprite looked ideally, but it is better, that it corresponded to size of model (so it will be easier to be guided in MAPEDIT). Save changes and leave.
Stage 2. Definition of type and identifier assignment sprite
Start ARTEDIT, move to added sprite and press «Enter». To choose type sprite, press a key «W». By the way, there are two types of voxels: VOXEL – static model which is used for objects and SPINVOXEL - rotating model used for weapon and items. Choose type VOXEL, and then appropriate identifier by means of a key «V». If want to add new model in game, use values with 65 if wish to replace standard model – it is necessary to know its number. The full table of identifiers can be found in head "In addition" for now appropriate value 65. Save changes and leave.
!IMPORTANT: All appropriated numbers of models are stored in file VOXEL.DAT. Don't forget to deliver it together with your add-on!
Stage 3. Adding *.KVX file to resource archive
For addition *.KVX files program BARF which can be found on a disk with game, or in section "Files" on a site of the Russian Bloody Community is required to us. If is simple so to add file in archive – in game will change nothing, therefore we need to write special script.
• Create text file in folder with Blood and name it "VOX.RFS". Open its notepad and enter following lines, without forgetting about inverted commas and a semicolon:
Code: Select all
resource "box01.kvx" as 65; ;
• Create text file and name it "BOX.BAT". Open its notepad and enter following lines:
Code: Select all
barf blood.rff @vox.rfs
On it process of addition of model in game is finished, you needed to come only in editor, create map and insert into it treasured sprite which in game will turn to the beautiful box absolutely not different from those as if it drew sector. As a result we had an opportunity to change its sizes or to make its destroyed with emission of useful items for the player. Besides it is good economy of sectors.
Sometimes, if model too volume, player can slip through it while it won't block sprite, belonging to it. Here it is possible to advise only one – to impose invisible blocking sprites model and to make their Gib-objects.
As you can see, all has appeared much easier, than it seemed at first sight. POLY2VOX qualitatively converts models and does their interiors empty at the expense of what saves game resources. It is possible to use 3D-rippers, allowing to pull out model from any 3D game, for example, 3DRIpperDx and thus to provide to itself comfortable existence. In SLAB6 there is a set of other means with which you can edit your model: to remove unnecessary pixels, to lighting\darking, to increase\reduce sizes or copy its parts. All questions and wishes write here and it is not forgotten tell thanks Nil for its first article about models.
Full ID table for *.KVX files
Artifacts (not added files in game)
Polygonal box model
This article on russian language
Article about voxels from Nil (RU)