[OPTing] texture limits

Need help editing the game? Check for help here!

Moderators: Darksaber, General_Trageton, Forceflow

Re: [OPTing] texture limits

User avatar
Warb_Null
Cadet 3rd Class
XWAU Member
Posts: 42
Joined: Tue May 15, 2018 6:49 pm

Post by Warb_Null » Wed Aug 08, 2018 11:31 am

I have a question.
I have a model of a fighter with a transparent canopy that keeps crashing the game.
I narrowed it down to the canopy being the cause. When i delete the canopy everything is fine. When i apply a BMP texture to the canopy everything is fine. When i apply a PNG texture it crashes the game. I tried using the canopy texture from the A-wing, stil crashing.
The pilots goggles also have a transparrent PNG but this causes no problem.

JeremyaFr
Lieutenant
XWAU Member
Posts: 879
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Thu Aug 09, 2018 7:20 pm

Hello,
When a PNG image is imported, it is loaded as a 32-bit texture. You need to convert it to 8-bit by clicking on "Convert All to 8 bits".

User avatar
Warb_Null
Cadet 3rd Class
XWAU Member
Posts: 42
Joined: Tue May 15, 2018 6:49 pm

Post by Warb_Null » Thu Aug 09, 2018 9:01 pm

I did that but it still crached :(
I think it mhas something to do with the mesh. I remade the canopy with a lower facecount and that seemed to resolve it. No more crash :)
Could there be a different limit for face number when using tranparency?
Anyway, it's resolved now. Thanks for the help.

JeremyaFr
Lieutenant
XWAU Member
Posts: 879
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Aug 10, 2018 3:42 pm

I'm able to reproduce the crash.
You're right. The game crashes when a mesh with a high face count has a transparent texture.

JeremyaFr
Lieutenant
XWAU Member
Posts: 879
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Aug 31, 2018 7:37 pm

UPDATE

Hello,
I've include the 'triangling to infinity' patch to the opt limit hook.

Please redownload xwa_hook_opt_limit.zip

Bman
Lieutenant JG
Posts: 508
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Mon Nov 05, 2018 12:48 am

Hi Jeremy, wanted to clarify the vertice possibilities. Assume an .opt model is maxed out at 50 meshes (not including low LOD meshes).
If I set the hook_opt_limit.cfg file to "Size = 32768" does that mean "each" mesh can have up to a maximum of 32,768 vertices ?
If not, what would be limits per any given mesh ? Thanks.
W-I-P: ISD-II, XQ-1 Platform1, New Escort Carrier Hangar, & Misc.

JeremyaFr
Lieutenant
XWAU Member
Posts: 879
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Mon Nov 05, 2018 8:41 pm

Hi Bman,

I think it is safe to have up to 15000 vertices per mesh. With more, the game may crash.

With this patch, one can reach up to 20000 vertices. With more, the game may crash or the craft may not be rendered.

Code: Select all

; increase the vertex count
At offset 0882D0, replace 00A60E00 with 00B12100.
At offset 0882DF, replace 409C0000 with 60670100.

Bman
Lieutenant JG
Posts: 508
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Tue Nov 06, 2018 12:26 am

Great! 20k. :-) So implementing the above Offset patch, I'm still confused on what the hook_opt_limit.cfg (Size = value) means. The .dll uses default of 4096. Does "value" represent the maximum allowed vertice count for any given mesh, or does "value" represent the maximum vertices allowed per FaceGroup within a given mesh ?

You mentioned earlier you had fixed the crashing issue of a "FaceGroup with more than around 1024 3d vertices. I've increased the size of the execute buffer to fix the buffer overflow. The limit is now around 32768 3d vertices." I think I'm getting the two confused. Thanks :-)
W-I-P: ISD-II, XQ-1 Platform1, New Escort Carrier Hangar, & Misc.

JeremyaFr
Lieutenant
XWAU Member
Posts: 879
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Tue Nov 06, 2018 9:25 am

The value in hook_opt_limit.cfg represents the vertices count in the mesh vertices node in the opt file. In XwaOptEditor, the value is shown in the V column of the mesh list or in the Geometry/Vertices tab. When the limit is exceeded (without the hook, the limit in the exe is 512), the game may crash when the craft is hit.

User avatar
Driftwood
Lieutenant Commander
XWAU Member
Posts: 1296
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Tue Nov 06, 2018 2:11 pm

Is this something that is going to be made a default increase to 15-20k vertices at some point, or should we plan on sticking with 4096/mesh?

JeremyaFr
Lieutenant
XWAU Member
Posts: 879
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Tue Nov 06, 2018 3:17 pm

Hello,
Here is a few test opt files:
opt_limits_70.zip
(492.79 KiB) Downloaded 4 times
Setup:
  1. Set Size=12000 in hook_opt_limit.cfg
  2. Apply the above patch
Results:
  • limits_1_1_69_69.opt seems to work
  • limits_1_1_70_70.opt seems to work
  • limits_1_1_71_71.opt doesn't work
If the patch works and the game doesn't crash, I will add it to the hook.

Bman
Lieutenant JG
Posts: 508
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Fri Nov 09, 2018 4:27 am

Tested, thanks. I inserted the below into the Patcher.xml file in my XwaExePatcher-1.0.7 folder:

Code: Select all

  <Patch Name="Increase the vertex count per mesh">
    <Item Offset="0882D0" From="00A60E00" To="00B12100" />
    <Item Offset="0882DF" From="409C0000" To="60670100" />
  </Patch>
I made copies of each .opt listed above and renamed as Awing.opt and AwingExterior.opt and tested in Skirmish mode with other Awings and also as my player craft. Confirmed. The first two seemed to work fine. The last one crashed one time to desktop, but usually it ran fine but the texture map was always invisible. I used Size=12000.

So if using the limits_1_1_70_70.opt (which is 39200 or 10084 vertices) does that mean we should set hook_opt_limit.cfg Size = 39200 as the maximum ?


.
W-I-P: ISD-II, XQ-1 Platform1, New Escort Carrier Hangar, & Misc.

Post Reply