[OPTing] texture limits

A Forum dedicated to the Suggestion, Creation and Editing of XWA Dynamic Link Library Files

Moderator: JeremyaFr

Re: [OPTing] texture limits

User avatar
Warb_Null
XWAU Member
Posts: 99
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.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
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
XWAU Member
Posts: 99
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.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
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.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
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 Commander
Posts: 1167
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: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
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 Commander
Posts: 1167
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: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
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
Admiral (Moderator)
Posts: 2174
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?

User avatar
JeremyaFr
XWAU Member
Posts: 3918
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
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.
You do not have the required permissions to view the files attached to this post.

Bman
Lieutenant Commander
Posts: 1167
Joined: Mon Apr 05, 2004 11:01 pm

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

.
Last edited by Bman on Sat Dec 15, 2018 12:32 am, edited 1 time in total.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Mon Nov 26, 2018 8:52 pm

UPDATE

Hello,
Here is a tool to easily download my editing tools:
XwaToolsDownloader.zip

Usage:
1) Run XwaToolsDownloader.exe.
2) It will download the tools list ( "xwa_tools_list.txt" ) from GitHub. To redownload the list, delete the "xwa_tools_list.txt" file.
3) It will create a directory named "_archives" and download the tools into this directory. Only the new tools are downloaded.
4) It will extract the tools. Only the new tools are extracted.

Supported tools:
- XwaDatEditor
- XwaCbmEditor
- XwaOptEditor
- XwaImcEditor
- XwaSnmConverter
- ZtPatcher

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Tue Nov 27, 2018 8:47 am

Thanks Jeremy :)
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Dec 01, 2018 1:52 pm

TEST

Hello,
I found how to remove the vertices count limit for meshes that have a transparent texture. It seems to also work for non transparent textures.

limits_1_1_150_150-2.zip

This opt contains a mesh that has 90 000 triangles, 180 000 vertices. To test it, you have to set "Size = 65536" in "Hook_Opt_Limit.cfg".

I will update the Opt dll and XwaOptEditor to apply the change. It seems that there is no longer a vertices count limit. The limit will be the performance.
EDIT: done
You do not have the required permissions to view the files attached to this post.
Last edited by JeremyaFr on Sat Dec 01, 2018 3:58 pm, edited 1 time in total.

User avatar
Driftwood
Admiral (Moderator)
Posts: 2174
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Sat Dec 01, 2018 2:10 pm

:shock:

Glen merge buff dun!?

Holy moly!

Luxury yacht's going to be getting an update then. It shall be absolutely opulent! I've got other stuff in working on at the moment, but I wasnt fully satisfied with the interior.

I'm imagining all the potential in regards to larger items and environment props, rather than small ships.

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Sat Dec 01, 2018 2:41 pm

Confucius say.... Just because you can, doesn't mean you should
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

Bman
Lieutenant Commander
Posts: 1167
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Sat Dec 01, 2018 6:19 pm

Brilliant. Then low level LOD's become more relevant to offset high poly count meshes.
There you go DTM, an open door for a new Death Star model and surface buildings and cities and landscape projects. :-)
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Dec 01, 2018 7:39 pm

UPDATE

Hello,
I've updated the opt limit hook to increase the vertices size limit from 4096 to 65536.

Please redownload xwa_hook_opt_limit.zip

User avatar
Driftwood
Admiral (Moderator)
Posts: 2174
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Sat Dec 01, 2018 7:44 pm

I can't seem to access your onedrive, it's crashing.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Dec 02, 2018 4:36 pm

My OneDrive is fine.

User avatar
Driftwood
Admiral (Moderator)
Posts: 2174
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Sun Dec 02, 2018 5:13 pm

Must have been doing server maintenance then when I checked.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Dec 14, 2018 5:38 pm

UPDATE

Hello,
I've included a patch to the opt limit hook. This patch fixes a crash when a face has a flat texture.

Please redownload xwa_hook_opt_limit.zip

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Fri Dec 14, 2018 6:40 pm

Thank you :)
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Apr 05, 2020 12:56 pm

UPDATE

Hello,
I've updated the opt limit hook.

I've included a patch to fix a bug related to the depth buffer.
At certain orientations, there were triangles that were drawn where they should not have.
This is related to how the depth values are computed and to the distribution of the z values along the 0.0 to 1.0 range. These lead to a wrong depth order.

I've fixed that.

Post Reply