Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Fri Mar 29, 2024 3:55 pm
All times are UTC + 0
HVA File format
Moderators: stucuk
Post new topic   Reply to topic Page 1 of 1 [9 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
shiny
Guest




PostPosted: Sun Aug 10, 2008 10:11 pm    Post subject:  HVA File format Reply with quote  Mark this post and the followings unread

I have written a VXL reader, and it works quite well. I'm currently trying to get HVAs to work.

The main example I've been using is hmec.vxl & hmec.hva. I can read the hmec.vxl file and display a 3d voxel rendering of it (even with normals, thanks to the normals.pas in OS Voxel Tools). If I use the transformation matrices in the voxel section tailers (and sticking on a 0 0 0 1 row at the bottom) then I can get all the sections of the voxel file to line up correctly and have a standing up mec. The transformations I do are:
- Camera set up
- Apply transformation matrix from the section tailer
- Apply a translation of (minX, minY, minZ) (where min is the minimum bounds from the section tailer)
I also use the bounds & the x/y/z size to calculate the scaling ratio between screen coordinates and voxels, and multiply the coordinates of each voxel by it.

If I try to apply a frame from the HVA I just get epic fail. I multiply the x,y,z translation parts of the matrix (last column, top 3 rows) by the scale factor (det in the OS Voxel Tools code) in the section tailer (always == 0.083333 though). Then I apply it in place of the transformation matrix from the section tailer. It doesn't produce anything like the correct result, the sections are just randomly shoved together quite comically.

I have checked that I am reading the HVA file correctly by taking the pascal reader from OS Voxel Tools and compiling it separately, and the results it spits out match what I'm reading in C++.

I have deduced all the HVA format and meaning from the OS Voxel Tools code and the code installed with the 'OSHVABUILDER_2.1.exe' binary. As far as I can tell I'm doing exactly what they do, but failing.

I see that the comments in the HVA.pas file mention tibsun-hva.doc by The Profound Eol. I can't find a copy of this anywhere, so if anyone has it I'd really appreciate a copy.

This is really frustrating me, so if anyone has any ideas what I'm doing wrong, any input would be great.

Thanks.

Back to top
Dupl3xxx
Commander


Joined: 22 Aug 2006
Location: somewhere south of the north pole

PostPosted: Mon Aug 11, 2008 5:24 am    Post subject: Reply with quote  Mark this post and the followings unread

You completed tha voxel-view-something-tool? Download?? Oh, and remember to log in Wink

_________________
This is a signature

Back to top
View user's profile Send private message Visit poster's website
shiny
Civilian


Joined: 11 Aug 2008
Location: The internet

PostPosted: Mon Aug 11, 2008 8:53 am    Post subject: Reply with quote  Mark this post and the followings unread

Solved my issue. I was reading the matrices in correctly, but putting them in the wrong place. I was doing:
Code:

for each section:
  for each frame:
    read in Transformation(section, frame);
  end;
end;

I should have been doing
Code:

for each frame:
  for each section:
    read in Transformation(section, frame);
  end;
end;


I now have a walking mech! It all seems so obvious now...

OS Voxel Tools does everything my code can do, plus a HUGE amount (like editing, sane camera view etc) - mine's just in C++ (and hopefully more understandable code :p). The viewer is something I hacked up very quickly, so the camera is fixed in a bit of an odd position, and is horribly inefficient.

However I'm happy to release the code, just need to find out what license OS Voxel Tools is under, as I've used that code quite a bit (the normals table is copied straight from it). I have not got a Windows development environment set up at the moment, so can't do a windows exe, but the code should compile fine on windows I think (SDL/OpenGL from drawing).



shot.png
 Description:
This is the mec halfway through the animation (yep, the camera is rubbish. and it's fixed in that position). Normals/lighting applied, but not sure if the lighting is exactly correct.
 Filesize:  28.23 KB
 Viewed:  9637 Time(s)

shot.png



_________________
If at first you don't succeed, get a bigger hammer.

Back to top
View user's profile Send private message
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Mon Aug 11, 2008 9:15 am    Post subject: Reply with quote  Mark this post and the followings unread

The liscense is pretty much what is showed in the installation from most of the programs here.

"Do whatever you want with it as long as you credit the authors and if you make a new version, point ppmsite.com and cnc-source.com as the official site to get the latest versions."


Anyway, you simply need to credit me and Stucuk for the code taken from OS:HVA Builder (and me, Stucuk, Will, Koen and Plasmadroid for VXLSE III's code you use).

Back to top
View user's profile Send private message Visit poster's website Skype Account
shiny
Civilian


Joined: 11 Aug 2008
Location: The internet

PostPosted: Mon Aug 11, 2008 9:49 am    Post subject: Reply with quote  Mark this post and the followings unread

OK, that sounds fair. I will put that message on all the code that is derived from the OS Voxel Tools/OS HVA Builder, and reconsider the license.

_________________
If at first you don't succeed, get a bigger hammer.

Back to top
View user's profile Send private message
Dupl3xxx
Commander


Joined: 22 Aug 2006
Location: somewhere south of the north pole

PostPosted: Mon Aug 11, 2008 11:06 am    Post subject: Reply with quote  Mark this post and the followings unread

It looks good so far, just fix the angle of the camera. Oh, and download when a windows version is ready!

_________________
This is a signature

Back to top
View user's profile Send private message Visit poster's website
YuriX
Medic


Joined: 14 Jan 2006

PostPosted: Mon Aug 11, 2008 3:29 pm    Post subject: Reply with quote  Mark this post and the followings unread

shiny wrote:

I was reading the matrices in correctly, but putting them in the wrong place. I was doing:
Code:

for each section:
  for each frame:
    read in Transformation(section, frame);
  end;
end;

I should have been doing
Code:

for each frame:
  for each section:
    read in Transformation(section, frame);
  end;
end;



Oh dear, I just checked my HVA loader and found I had made the same stupid mistake. #Tongue

Back to top
View user's profile Send private message Skype Account
shiny
Civilian


Joined: 11 Aug 2008
Location: The internet

PostPosted: Mon Aug 11, 2008 7:22 pm    Post subject: Reply with quote  Mark this post and the followings unread

Interestingly HVA Builder seems to read them frame-fastest too, and I've found myself a copy of tibsun-hva (http://xhp.xwis.net/downloads/vxlstuff.zip, can't believe I didn't find that before) and it indicates that the matrices are stored frame-fastest, whereas I'm getting great results reading them section-fastest. I will have a closer look at what I'm doing, it could just be some really obvious bug in my program that is confusing me.

[edit]I've had a careful look at my code (HVA reading is nice and simple, so not much to study ;p), and really can't see any bugs - I really do seem to be reading it section-fastest. Reading it that way I get a nicely walking mech, the other way, a jumbled mess.

[edit]Solved. The HVA.pas file in the OS Voxel Tools SVN is out of date. The one shipped with OS HVA Builder has a different loader, which loads all of the matrices into one big array. To look up a matrix it uses ((frame * numSections) + section), so they are section-fastest.

_________________
If at first you don't succeed, get a bigger hammer.

Back to top
View user's profile Send private message
stucuk
Geek


Joined: 27 Aug 2002

PostPosted: Sun Sep 14, 2008 10:46 am    Post subject: Re: HVA File format Reply with quote  Mark this post and the followings unread

shiny wrote:
I see that the comments in the HVA.pas file mention tibsun-hva.doc by The Profound Eol.


I know im replying to an old post but you can get the file from XCC's website (3rd party downloads).

- VXL Stuff ~87.5KB

_________________
Free Map Editor - Game Requirements - Stucuk.Net

Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [9 Posts] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
Quick Reply
Username:


If you are visually impaired or cannot otherwise answer the challenges below please contact the Administrator for help.


Write only two of the following words separated by a sharp: Brotherhood, unity, peace! 

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

[ Time: 0.1679s ][ Queries: 14 (0.0111s) ][ Debug on ]