Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 12.09.2006, 20:07   #5
Mirror
Архивный участник
 
Join Date: Oct 2005
Posts: 330
Default

Quote:
Originally Posted by Stazis View Post
Mirror - can you give some tips what should be corrected with terrain
do so i'll fix a convertor and release a new pack.

i already know that should use 8*8 blocks and calculate walkability flags for terrain too
only thing bothering me is an technique how client forms an triangles from heights - it is not formed regularly from left top to right buttom corner or vice versa - there is someth like diamond triangulation used to define ... if i find it - terrain will be perfect.
about terrain if you open utx with UTPT you will see the BMP size is a bit more than 131072 bytes ( 16 bit accuracy ) and has also an offset. the corect size is 131072 bytes. the more bytes are useless header you just need to read 131072 bytes, calculate from the end and remove the difference. you will have a one channel 16but accuracy .raw ( or .bmp if you wish but reading a .raw is much easier ). you can make this 256*256 .raw into 2048*2048 via photoshop and then just read and write heights to a terrain only geo and voila you have PERFECT TERRAIN, we also used to add 32 units height to geo and then shift the terrain two small ( 2048 ) blocks in x and y. we use zdiff 24 for flags but you in some cases even 16 is good

so it's not true you cant make perfect terrain from .bmp you just need not to open it with UTPT cuz it discards 8bit info

p.s. catacomb of branded for some reason has serious problems and also terrain over tombs when it is 4100 layer has no flags ( devastated castle front of it, EG tomb ). i also think in some geos you frame it with flags

utxreader.c

#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[]) {


FILE *fi, *fo;
unsigned long int counter = 0;
unsigned char dummy,height;
unsigned int offset,size,realoffset;
unsigned int x,y;

if (argc != 5) {
printf("Usage : utxreader 'UTX file' 'RAW file' 'OFFSET' 'SIZE'\n");
exit(0);
}


offset = atoi(argv[3]);
size = atoi(argv[4]);
realoffset = offset + size - 10 - 131072;

if ((fi=fopen(argv[1],"rb"))!=NULL) {
for (y=0;y<=realoffset-1;y++) fread(&dummy, sizeof(dummy), 1, fi);
if ((fo=fopen(argv[2],"wb"))!=NULL) {
for (x=0;x<=131071;x++) {
fread(&height, sizeof(height), 1, fi);
fwrite(&height, sizeof(height), 1, fo);
counter++;
}
}
fclose(fo);
}
fclose(fi);


printf("%lu heights were written\n",counter);

return 0;
}
Mirror is offline  
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 18:26.