Posted: Sun Aug 10, 2008 10:11 pm Post subject:
HVA File format
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.
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)
_________________ If at first you don't succeed, get a bigger hammer. QUICK_EDIT
Also Known As: banshee_revora (Steam) Joined: 15 Aug 2002 Location: Brazil
Posted: Mon Aug 11, 2008 9:15 am Post subject:
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). QUICK_EDIT
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. QUICK_EDIT
Joined: 22 Aug 2006 Location: somewhere south of the north pole
Posted: Mon Aug 11, 2008 11:06 am Post subject:
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 QUICK_EDIT
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. QUICK_EDIT
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