[OPTing] texture limits
Moderator: JeremyaFr
Re: [OPTing] texture limits
- Warb_Null
- Posts: 99
- Joined: Tue May 15, 2018 6:49 pm
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.
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
- Posts: 3848
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
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".
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".
- Warb_Null
- Posts: 99
- Joined: Tue May 15, 2018 6:49 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.

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
- Posts: 3848
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
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.
You're right. The game crashes when a mesh with a high face count has a transparent texture.
- JeremyaFr
- Posts: 3848
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
UPDATE
Hello,
I've include the 'triangling to infinity' patch to the opt limit hook.
Please redownload xwa_hook_opt_limit.zip
Hello,
I've include the 'triangling to infinity' patch to the opt limit hook.
Please redownload xwa_hook_opt_limit.zip
-
- Posts: 1157
- Joined: Mon Apr 05, 2004 11:01 pm
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.
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.
- JeremyaFr
- Posts: 3848
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
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.
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.
-
- Posts: 1157
- Joined: Mon Apr 05, 2004 11:01 pm
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

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.
- JeremyaFr
- Posts: 3848
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
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.
- Driftwood
- Posts: 2173
- Joined: Wed Oct 22, 2003 11:01 pm
- Contact:
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
- Posts: 3848
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
Hello,
Here is a few test opt files: Setup:
Here is a few test opt files: Setup:
- Set Size=12000 in hook_opt_limit.cfg
- Apply the above patch
- 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
You do not have the required permissions to view the files attached to this post.
- JeremyaFr
- Posts: 3848
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
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
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
“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
- John Lydgate
Good Things Come To Those Who Wait....
Darksaber's X-Wing Station
- JeremyaFr
- Posts: 3848
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
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.
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
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.
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.
- Driftwood
- Posts: 2173
- Joined: Wed Oct 22, 2003 11:01 pm
- Contact:

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.
- Darksaber
- Posts: 10931
- Joined: Mon Jan 10, 2000 12:01 am
- Contact:
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
- John Lydgate
Good Things Come To Those Who Wait....
Darksaber's X-Wing Station
-
- Posts: 1157
- Joined: Mon Apr 05, 2004 11:01 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.
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.
- JeremyaFr
- Posts: 3848
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
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
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
- Driftwood
- Posts: 2173
- Joined: Wed Oct 22, 2003 11:01 pm
- Contact:
I can't seem to access your onedrive, it's crashing.
- Driftwood
- Posts: 2173
- Joined: Wed Oct 22, 2003 11:01 pm
- Contact:
Must have been doing server maintenance then when I checked.
- JeremyaFr
- Posts: 3848
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
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
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
“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
- John Lydgate
Good Things Come To Those Who Wait....
Darksaber's X-Wing Station
- JeremyaFr
- Posts: 3848
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
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.
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.