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

Load Faster & Use Less RAM #1

Open
snake-biscuits opened this issue Nov 15, 2021 · 5 comments
Open

Load Faster & Use Less RAM #1

snake-biscuits opened this issue Nov 15, 2021 · 5 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@snake-biscuits
Copy link
Owner

snake-biscuits commented Nov 15, 2021

Use the bpy .foreach_set method with NumPy to speed up mesh assembly. Can also use the new Vertex lookup method from bsp_tool/src/glview.cpp to save some time

VertexReservedClass -> NumPy array will likely be the hardest step

@snake-biscuits snake-biscuits added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Nov 15, 2021
@snake-biscuits
Copy link
Owner Author

snake-biscuits commented Jan 26, 2023

bpy.types.Mesh.from_pydata might be a better solution1
Profiling tools do exist,23 and it is also possible to run Blender "headless" to compare different approaches.
Regardless,: finding a performant way to load large maps (e.g. Apex Legends maps) will make development much easier.

Footnotes

  1. b3d.interplanety.org: How to create mesh through the Blender Python API

  2. wiki.blender.org: Profiling Python Code

  3. devtalk.blender.org: Plugin-Profiler | benchmark / debug your bpy work

@snake-biscuits
Copy link
Owner Author

Another option would be to merge meshes for each model,
Blender attaches a lot of metadata to objects, so reducing groups could be helpful

Maintaining the "mesh groups" defined by bsp.LEVEL_INFO for worldspawn should help with visibility etc.
This would allow for hiding or even skipping decals & skybox, as well as clearly detecting transparent geometry & materials

@snake-biscuits
Copy link
Owner Author

Another option would be to merge meshes for each model

Specifically, merging meshes into models before generating them, which should improve import speed (theoretically)

@snake-biscuits
Copy link
Owner Author

Just wrapped up an update for faster load times in snake-biscuits/bsp_tool#80
Should be able to update to that version of bsp_tool pretty soon
Though I might make it bsp_tool version 0.5.0

@snake-biscuits snake-biscuits self-assigned this Jul 29, 2023
@snake-biscuits snake-biscuits removed help wanted Extra attention is needed good first issue Good for newcomers labels Jul 29, 2023
@snake-biscuits
Copy link
Owner Author

Mesh(...).from_pydata is the way to go (no numpy required)
uvs & vertex colour could get tricky

I do need to take a proper look at vertex colour
Need to check w/ Fifty & others to check VertexReservedX structs are all synced up
That's for another issue though

@snake-biscuits snake-biscuits changed the title Performance Solution Load Faster & Use Less RAM Aug 12, 2023
@snake-biscuits snake-biscuits added this to the 1.3.0 milestone Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

No branches or pull requests

1 participant