Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Tools => Topic started by: Zacam on December 01, 2010, 06:55:10 am

Title: Dimensions and Bounding box issues on save
Post by: Zacam on December 01, 2010, 06:55:10 am
So, working on mjn.mixaels missiles, I ran into the following issue.
(This example is from the Cyclops (Belial))

PCS2 2.1 11/29/2010
DAE/PMF;
H:1.74, W: 1.66, D: 6.80 (matches retail sans the modeled thruster cone)
Bounding Box Min: -0.83, -0.77, 0.00
Bounding Box Max: 0.83, 0.97, 6.80
Radius: 6.806166

Either DAE or PMF to POF:
H: 2.18, W: 2.10, D: 7.24
Bounding Box Min: -1.05, -0.99, -0.22
Bounding Box Max: 1.05, 1.19, 7.02
Radius: 7.196439

The hell?

Edit: All three dimensions are getting 0.44 added to them.
Title: Re: Dimensions and Bounding box issues on save
Post by: Angelus on December 01, 2010, 07:05:07 am
this happens with all models in all versions. i always thought that pcs2 is supposed to work that way, until i heard that it's not.
Title: Re: Dimensions and Bounding box issues on save
Post by: Spicious on December 01, 2010, 07:15:39 am
I believe this is intentional. The BSP code adds a little bit extra to the bounding boxes. If you resave a POF with cached BSP data you should get a different bounding box, which may or may not have 0.1/0.2 added to everything.
Title: Re: Dimensions and Bounding box issues on save
Post by: Zacam on December 01, 2010, 09:19:02 am
Not fine. Look at retail POF (ex: Belial). When in subobject view, the bounding box closely follows the mesh (in orthographic view)

On the retail model if you add the sub-object for the thruster dimensions to the detail0 dimensions you get the header reported dimensions.

I can't go making the models .44 smaller on all dimensions for fear of the bounding box (and thus hit detection and collision detection) being thrown off by it just to compensate.
Especially when the PMF can apparently save it out just fine.
Title: Re: Dimensions and Bounding box issues on save
Post by: Spicious on December 01, 2010, 05:05:03 pm
It turns out that the model comment saving code is only saving the first comment so it always rebuilds the BSP data.

Still, if you save twice, you should see a difference between the two files. If you download a new build now it won't add anything extra to the bounding boxes in the latter case. The POF radius seems to be calculated by using the distance from (0,0,0) to the furthest bounding box corner instead of the furthest vertex though.
Title: Re: Dimensions and Bounding box issues on save
Post by: Zacam on December 02, 2010, 02:11:23 am
Code: (pcs2.exe) [Select]
Warning OGL reported "invalid value" at .\geo_sphere.cpp (190) please report this issue

Occurred with 12/01/2010 version when opening .pmf saved with 11/29/2010 version.

EDIT: Still getting dimension changing padding taking place. Glad that the Model Comments was fixed, though.

EDIT2: So, opened the saved POF and saved it again directly as a new copy, and I have the dimensions that I want and that I specified. I can deal with that.
/me hugs Spicious in a purely platonic happy way

Thank you.
Title: Re: Dimensions and Bounding box issues on save
Post by: Spicious on December 02, 2010, 02:24:26 am
Interesting. Try a new build now. You might want to clear the BSP cache for anything saved previously.

Edit: subobject/model radii are still the same though.

Edit2: try this (http://mt.hard-light.net/spicious/pcs2-nobox.7z) if you're still getting the OGL thing.
Title: Re: Dimensions and Bounding box issues on save
Post by: Zacam on December 02, 2010, 04:22:11 am
12/02/2010 Version:
DAE/PMF to POF with PurgeBSP cache: I don't have to open and re-save the POF for dimensions.

Also, no OGL Error reported on the PMF from earlier. (It may have been a fluke) If it happens again with any other models, I'll immediately determine if it's reproducible and try the other build.

**EDIT: Crop. Bounding Box Min and Max are swapped. Or atleast, are read by DAE and saved to PMF as swapped. Saving as POF is still fine.
**Edit 2: Hmm. Or not, may have just been that DAE, but I'll keep my eye on it.

**Edit3: Hmm. I keep getting strange holes in my geometry on some models with 12/02/2010.
Title: Re: Dimensions and Bounding box issues on save
Post by: Spicious on December 02, 2010, 08:00:31 am
**Edit3: Hmm. I keep getting strange holes in my geometry on some models with 12/02/2010.
Not too surprising. The fudge margins were there for a reason. Try it with a new build. Reproduceable holes would be useful too.
Title: Re: Dimensions and Bounding box issues on save
Post by: mjn.mixael on December 02, 2010, 08:34:54 am
12/02/2010 Version:
**Edit3: Hmm. I keep getting strange holes in my geometry on some models with 12/02/2010.

I have been getting this a lot as well.
Title: Re: Dimensions and Bounding box issues on save
Post by: Spicious on December 07, 2010, 02:28:46 am
Has anyone checked for holes with a newer build?
Title: Re: Dimensions and Bounding box issues on save
Post by: mjn.mixael on December 07, 2010, 08:53:03 am
I haven't checked yet with a newer build, but I did figure out the general area that was causing the holes. It had something to do with triangulation. When I exported my models as DAE, I usually let OPENCollada do the triangulation, in a few select cases, the triangulation was bad and causes holes, when I turned that off for those models the holes were fixed.

The issue is still with PCS2 though, because I did do some testing. I imported several of the DAEs that resulted in POFs with holes into 3DS Max, and there were definitely not any holes anywhere. I also noticed that the holes are only visible after the conversion to POF. In other words, I had to export from Max, then save as POF, then open the POF to check for holes.

Anywho, I'll do some checking with the latest version when I get home today.
Title: Re: Dimensions and Bounding box issues on save
Post by: Spicious on December 11, 2010, 05:27:35 pm
I give up. The bsp stuff is now back to what it was before, but bounding box and radius calculations should be consistent with :v: models.