Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How many vertices are currently supported in a single .b3d file? #1066

Open
BPI-919 opened this issue Sep 28, 2024 · 3 comments
Open

Comments

@BPI-919
Copy link
Contributor

BPI-919 commented Sep 28, 2024

Description

Hi,

I have recently seen in the developer documentation, that maximum 65534 pieces of Vertex command can be accepted in 1 .b3d file.

Screenshot_2024-09-28-15-46-35-933_org mozilla firefox

I was thinking about the related warning messages appearing in Object Viewer, and I took a look at the source code, and I think I found an interesting thing...

Screenshot_2024-09-28-16-14-58-501_org mozilla firefox
Screenshot_2024-09-28-16-15-07-904_org mozilla firefox

As you can see above, according to the (source code) warning message, 65535 pieces of Vertex command is still acceptable.

So can you please clarify the maximum number of the supported Vertex commands in 1 .b3d file?

65534 pieces of Vertex command - allowed
65535 Vertex - still allowed (?)
65536 Vertex - not allowed (too many vertices)

Or 65536 is still supported, because in the source code, a[j] starts from 0 and ends with 65535, which means 65536 pieces of vertices are allowed (?).

I am also curious about the appearance of the [MeshBuilder] s:
What happens if I try to load an .b3d object with e.g. 65540 vertices / too many vertices ?
Let's say that 65532 Vertex commands are in 1 [MeshBuilder] , and the rest 8 Vertex commands are in another 1 [MeshBuilder] . In this case, the whole of the first [MeshBuilder] appear properly, and the second one does not appear at all, or will the loading of this .b3d object file produce another / different result(s)?

Thanks in advance for your answers!

@leezer3
Copy link
Owner

leezer3 commented Sep 28, 2024

Initially, the vertex index in a mesh was stored as a ushort
This gives a technical possible range of vertex indicies of 0 - 65,535 (hence actually 65,536 total possible).
It seemed better however to use 65,534 as most people don't understand the concept of zero-based indexing very well.

Michelle's parser never bothered to check the actual length of this number (other than by validating it was a valid index to a declared vertex), presumably as at the time it was written that many verticies were completely unusuable.

With regards to multiple MeshBuilders, it'll probably allow 65,536 vertices in each section, up-to a total of 2,147,483,648 vertices (That being the max positive length of an uint)
Realistically though, I suspect it'll either run out of memory or crash somewhat long before then.

Whilst I could quite easily change the parser to allow longer indicies, the entirety of support for larger objects isn't too great, and using things of this size slows down quite considerably.
This is somewhat worse with CSV / B3D objects as these are normally hand-built and have an ill-defined structure, which means that the whole parser is a bunch of additional hacks / bodges.
Re-writing the parser here is on a long list of things to do, but as it works tolerably at the moment, it's not high on that list......

@BPI-919
Copy link
Contributor Author

BPI-919 commented Sep 28, 2024

Ahh, okay, I understood. So every [MeshBuilder] section can contains 65536 Vertex commands. If I divide the 2,147,483,648 by 65,536 , I will get 32,768 , so 32,768 [MeshBuilder] can be present in every .b3d file. (Perhaps it is possible to create a Warning / Error message also for [MeshBuilder] limits. :D )
I misunderstood the limits, but now it is clear for me.

I faced another kind of thing:
If I have 1 or more error message(s) in Object Viewer, when I view them by pressing the F9 button, I cannot read the whole message, because the file path of the current (loaded) object file is not too short, and despite I try to widen on the column of the text message every time, it seems that there can be a limitation in the maximum length of the visible message...
So can you please duplicate the maximum length of the writable log-message in Object Viewer and Route Viewer?
...because now I cannot read the entire message per messages. :/

@leezer3
Copy link
Owner

leezer3 commented Oct 7, 2024

I can't reproduce the issue with error width.

The window will resize, and this grows the message.
You also ought to have a scrollbar at the bottom of the window, which will allow you to view anything that's offscreen.

If that's not working properly, can I see a screenshot of the message window?
Can't think of anything that would mess that up, unless it's the HU locale doing something funny :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants