Freelancer Community Network
Reminder: Internet Explorer 6 or below are NOT supported.
HomeHome
ForumForum
WikiWiki
DownloadsDownloads
ForgeForge
Multiplayer Connection Tutorial
Collapse/Expand Random Image
Collapse/Expand Login
Username:

Password:

Remember me



Lost Password?

Register now!
Collapse/Expand Chat
Collapse/Expand Who's Online
42 user(s) are online (17 user(s) are browsing Forum)

Members: 0
Guests: 42

more...
Collapse/Expand Donations
Monthly costs: -30€
Income (ads): +5€
Donations (last month): +0€

Current balance: -165€
(last updated 12/2018)

Please make a donation if you want to help keeping The-Starport online:

Bitcoin address:
Thanks!
Collapse/Expand Links
Collapse/Expand Advertisement
There are currently 32 users playing Freelancer on 29 servers.
December. 11, 2018

Browsing this Thread:   1 Anonymous Users



 Bottom   Previous Topic   Next Topic  Register To Post



Questions about SUR format
Not too shy to talk
Joined:
2010/8/27 14:02
Group:
Registered Users
Posts: 56
Offline
I'm working on a separate SUR implementation for my 3ds max toolkit and I've got some basics by now from SurDump, but since I plan on having importing/exporting I have a number of questions and assumptions I have that I'd like to see confirmation or clarification about.

1. What is "offset" (15 bits?) in triangle vertices (SurDump.h: Side.offset)? Is it two ints as split in SurDump or something else?
2. What is "opposite triangle index" in triangle header (SurDump.h: Triangle.m_tri_op)?

3. From what I've gathered THeader.type 4 is like a regular mesh while type 5 is a shrinkwrap mesh for the entire part encompassing volumes of sub-parts. Any other types used?

4. Is shrinkwrap mesh (type 5) necessary?

From what I've seen if a part contains only one convex mesh then it's not needed. But if part contains multiple convex meshes, whether for itself or to cover its children, including hardpoints with meshes but excluding (need confirmation here) non-fixed (moveable) children.

4.1. Fixed parts (i.e. those that do not have !fxd section-flag) shrinkwrap (or itself if doesn't use one) will appear in parent part mesh list. Moveable parts however (those that have !fxd flag) will not. Is this correct?

6. Root is always non-fixed.

7. Bits section is a kd-tree by the looks of it, but offset pointers are unclear to me. Would really need help pointing out what's in its structure.

8. Scale parameters I guess are single byte per axis representing equal or less multiplier as 1.0 to 0.0. Correct?

My intention is to have exporting/importing in max so as to keep everything within a single tool as well as expanding to cover features present in data formats but other existing tools do not have. Currently I have import routine, but in there I ignore various parameters that aren't really needed to reconstruct meshes back in 3ds max, but need to fill the gaps in understanding of the format to properly export data.

Other than that convex meshes are generated by PhysX/MassFX, it seem pretty robust and fast to generate hulls on the fly so I've made nice builder tool with preview.

p.s. I guess this list is mainly for Adoxa and Scotty/Schmakboltzen, but if anyone else knows I'd be happy to hear as well. Thanks.

Posted on: 8/11 18:09
Top
Re: Questions about SUR format
Just can't stay away
Joined:
2010/2/17 20:45
From Germany
Group:
Registered Users
Senior Members
Posts: 469
Offline
I can just redirect you to Schmackbolzen. I have experiemted in the game only, yet never worked with the internal data structures.
Perhaps he can remember a few bits from back then.

Posted on: 8/12 0:18
How to create .SUR files - Tutorial
Top
Re: Questions about SUR format
Home away from home
Joined:
2009/8/16 2:58
From Qld, Aus.
Group:
Registered Users
FLServer Admins
Trusted Speciality Developers
Senior Members
Posts: 1876
Offline
It's been eight years, don't expect much. I really only analysed what the file contained, rather than how it was used.

Quote:
1. What is "offset" (15 bits?) in triangle vertices (SurDump.h: Side.offset)? Is it two ints as split in SurDump or something else?

I couldn't tell you what it is (index to other triangles?), but I'm pretty confident that's how it's interpreted.

Quote:
2. What is "opposite triangle index" in triangle header (SurDump.h: Triangle.m_tri_op)?

I always thought it was the opposing face.

Quote:
3. From what I've gathered THeader.type 4 is like a regular mesh while type 5 is a shrinkwrap mesh for the entire part encompassing volumes of sub-parts. Any other types used?

Apparently not.

Quote:
6. Root is always non-fixed.

Apparently.

Quote:
7. Bits section is a kd-tree by the looks of it, but offset pointers are unclear to me. Would really need help pointing out what's in its structure.

8. Scale parameters I guess are single byte per axis representing equal or less multiplier as 1.0 to 0.0. Correct?

FindTriangleGroup might help with those.

Posted on: 8/12 2:35
Top
Re: Questions about SUR format
Not too shy to talk
Joined:
2010/8/27 14:02
Group:
Registered Users
Posts: 56
Offline
Quote:
Skotty. wrote:
I can just redirect you to Schmackbolzen. I have experiemted in the game only, yet never worked with the internal data structures.
Perhaps he can remember a few bits from back then.

Yeah that would be nice. Feels like I'm doing redundant steps to figure out what's what there. To be specific I'm interested in what to fill the bits section and what to put into "offset" in triangle vertices (where vertex indices listed per triangle). The rest seem pretty straight-forward if a little awkward in places (like those 12 bit ints and such), in comparison to vmesh buffers which are simple enough heh.

Quote:
adoxa wrote:
It's been eight years, don't expect much. I really only analysed what the file contained, rather than how it was used.

Any help to get a full picture is appreciated. The toolkit for 3ds max will be open source as well, too many tools languish in unfinished state and everything is so stand-alone.

Quote:
Quote:
1. What is "offset" (15 bits?) in triangle vertices (SurDump.h: Side.offset)? Is it two ints as split in SurDump or something else?

I couldn't tell you what it is (index to other triangles?), but I'm pretty confident that's how it's interpreted.

SurDump splits and does a few things there but I just can't figure what't the purpose nor does the source indicate where they'd be used at. The numbers themselves aren't obvious to me to give a hint what they might be.

Quote:
Quote:
2. What is "opposite triangle index" in triangle header (SurDump.h: Triangle.m_tri_op)?

I always thought it was the opposing face.

In that case firing ray opposite to face normal on every face probably would do the trick to pick opposing faces then. Is it actually used or is it just a byproduct of quickhull algorithm that is simply written into file?

Quote:
Quote:
3. From what I've gathered THeader.type 4 is like a regular mesh while type 5 is a shrinkwrap mesh for the entire part encompassing volumes of sub-parts. Any other types used?

Apparently not.

Quote:
6. Root is always non-fixed.

Apparently.

Ok, good to know, fewer things to worry about.

Quote:
Quote:
7. Bits section is a kd-tree by the looks of it, but offset pointers are unclear to me. Would really need help pointing out what's in its structure.

8. Scale parameters I guess are single byte per axis representing equal or less multiplier as 1.0 to 0.0. Correct?

FindTriangleGroup might help with those.


I guess that's a reconstructed code, the piece you linked seem like a filtering/collecting faces phase before SAT test or whatever they used there.

Posted on: 8/12 18:25
Top
Re: Questions about SUR format
Home away from home
Joined:
2009/8/16 2:58
From Qld, Aus.
Group:
Registered Users
FLServer Admins
Trusted Speciality Developers
Senior Members
Posts: 1876
Offline
Quote:
Treewyrm wrote:
In that case firing ray opposite to face normal on every face probably would do the trick to pick opposing faces then. Is it actually used or is it just a byproduct of quickhull algorithm that is simply written into file?

I set all the opposing indices to 0 in the root of docking_ringx2_lod.sur and still collided. So I can't say with any certainty but it does not appear to be used. Further experimentation will be up to you...

Posted on: 8/13 3:53
Top
Re: Questions about SUR format
Not too shy to talk
Joined:
2010/8/27 14:02
Group:
Registered Users
Posts: 56
Offline
Interesting. Had a hunch that not all data might be of use. Some redundant others being a byproduct. Having PartID hash tailed at every vertex in vertex buffer was baffling too.

Posted on: 8/13 10:29
Top
Re: Questions about SUR format
Just can't stay away
Joined:
2008/2/22 13:33
From that dark place in the back of your mind..
Group:
Registered Users
Senior Members
Posts: 330
Offline
What a time for me to have a nostalgia trip lol

Okay digging this out of the depths of my brain as it's been about 9 years since I last looked at a SUR, hell it's been nearly 9 years since I last looked at Freelancer.

4. Is shrinkwrap mesh (type 5) necessary? - if this is what I think it is then it depends on how you built the item your slapping a SUR on. They are designed to spread the damage to everything they cover, for example a wing on a ship that can be blown off, if it has a couple of hardpoints then anything on those hardpoints takes some damage when the wing is damaged directly.

Posted on: 8/14 21:30
**shuffles of with a new headache**
Top
Re: Questions about SUR format
Not too shy to talk
Joined:
2010/8/27 14:02
Group:
Registered Users
Posts: 56
Offline
Some progress. Mostly at importing functionality.

Open in new window

Posted on: 9/27 0:08
Top
Re: Questions about SUR format
Just can't stay away
Joined:
2012/5/22 20:21
Group:
Registered Users
Posts: 188
Offline
Looking good

Posted on: 9/27 6:44
Top
Re: Questions about SUR format
Home away from home
Joined:
2008/7/8 21:15
From Germany
Group:
Registered Users
FLServer Admins
Trusted Speciality Developers
Senior Members
Posts: 546
Offline
Sorry I wanted to answer, but forgot due to my (hopefully) last two exams. The bits section is a tree which you traverse (I can look details up if you still need it) its something like in-order traversal, but don't know from memory.

The outer convex hull is used to determine whether the tree has to be used for collision. Thus, if you only have one node in the tree you don't need it. You never can collide with it so that's why it has the special flag.

Since most physics engines use a BSP tree, I suppose it is one. I only implemented a KD tree and it seems to work, but not always.
I am considering to make my sur tool open source. I already sent FF my tree creation (it is written in Free Pascal), but he never had time to use it.

Posted on: 9/27 12:09
Top
Re: Questions about SUR format
Not too shy to talk
Joined:
2010/8/27 14:02
Group:
Registered Users
Posts: 56
Offline
Hi. Thanks for explanation. Can you send me tree-related code as well?

Yes, I've noticed outer hull is available per part only when it contains more than one collision hull. And nodes forming tree when I visualized their bounding spheres in scene as well.

I've covered most of the stuff so far (importing-wise, exporting is another story), even made a tool to "paint" convex meshes, which is a modified selection brush for vertices and edges that updates convex mesh generated by Nvidia PhysX tool. Generating offsets will be most annoying I'd assume.

Another benefit working in 3ds max directly is that outer 'shrinkwrap' mesh can be built with the knowledge of compound hierarchy and part transformations, particularly when a part contains fixed children which it seem to need to envelop as well.

While I hadn't much experience with free pascal I don't think it'll be a problem to figure it out and re-implement in 3ds max.

Posted on: 9/27 12:35
Top
Re: Questions about SUR format
Not too shy to talk
Joined:
2010/8/27 14:02
Group:
Registered Users
Posts: 56
Offline
Minor improvement for importing:

Open in new window

Reworked .sur importing, so that only parts and hardpoints present in model have their hitboxes meshes constructed and attached.

HUD wireframes (VMeshWire/VWireData) are loaded and are going to be exported as well.

On a side note about vertex normals and smoothing groups. Normals can be can be imported and assigned explicitly, but that has several drawbacks, so I've made it optional feature. Smoothing groups cannot be restored back from explicit normals and they remain unaffected by smoothing group you'd set their faces to (kinda obvious). I think what I can do is to export smoothing groups into custom UTF entry (let's say VMeshSmoothingGroups alongside VMeshData, which the game will ignore) but importer will recognize and restore those.

Animations are going to be major headache. They have no direct equivalent in 3ds max animation system, being far simpler and restrictive. Approximating it to max motion controllers might do for importing, but exporting that into FL's animation isn't going to be simple.

Coincidentally if anyone have a good idea what all those flags in compound animation scripts do it would help greatly. There's only so much I can pull from junk pile that is C:FW source code, and even that might have changed for FL.

Posted on: 9/28 12:34
Top
Re: Questions about SUR format
Home away from home
Joined:
2008/7/8 21:15
From Germany
Group:
Registered Users
FLServer Admins
Trusted Speciality Developers
Senior Members
Posts: 546
Offline
I have sent you a pm with the code.
What I don't understand is, what is the benefit of having it in Max? Is there something wrong with my tool? Maybe I can make some changes there. At least then you are not forced to use Max (which I don't have).

Posted on: 10/8 9:52
Top
Re: Questions about SUR format
Not too shy to talk
Joined:
2010/8/27 14:02
Group:
Registered Users
Posts: 56
Offline
Thanks for the code.

The benefit of having it in MAX is fairly simple - coherent development pipeline. I've initially started the toolkit to import and export models, not just meshes but proper hierarchy, constraint types, hardpoints, HUD wireframes and more which existing tools do not cover or only partially and never to extent the formats permit. I have custom objects and properties (which are persistent, so they're saved into scene files) to facilitate entities special to Freelancer. Naturally I'd like to add support for SUR, not just importing but exporting as well. There are many obvious benefits to this as everything remains within single software, and everything can be manipulated by wide array of native instruments available to 3Ds MAX user, not to mention countless popular third-party plugins to satisfy all modelling needs for Freelancer formats. Of course the price of any tight integration is portability. Initially I had worked on Collada converter but quickly realized its support varies greatly between modeling software to such extent that common denominator dataset is barely able to cover minimal support I seek.

So far I'm making slow but steady progress, adding early support for DFM while rummaging through landfill of C:FW source code to pick up anything applicable to FL.

Posted on: 10/8 12:52
Top
Re: Questions about SUR format
Just can't stay away
Joined:
2012/5/22 20:21
Group:
Registered Users
Posts: 188
Offline
While i admire your efforts in this Treewyrm, i have no understanding of it and don't wish to, I'm with Schmackbolzen on this regarding the question why?

There are plenty of us, me included who do not have MAX, and have no intention of getting it. The advantage at the moment with those of us who mess with sur files is that the sur tool that Schmackbolzen wrote works for a large percentage of models, both static and those with parts. While I agree a MAX plugin and exporter will be nice for those that have it, plenty of us don't.

If any upgrades need doing, the two of you should discuss what needs fixing (if anything) and update accordingly, so everyone can use the sur utility, instead of limiting any major upgrades to MAX users only.

Posted on: 10/8 19:13
Top