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

Optimization: Modularize asset kit for buildings #12

Open
madjin opened this issue Jun 2, 2023 · 4 comments
Open

Optimization: Modularize asset kit for buildings #12

madjin opened this issue Jun 2, 2023 · 4 comments

Comments

@madjin
Copy link
Contributor

madjin commented Jun 2, 2023

image

To make a bigger world, we need to modularize assets so that we can use gltf-extension for instancing that hyperfy now supports. Here is an example architecture kit from mozilla hubs: https://hubs.mozilla.com/docs/spoke-architecture-kit.html

image

This way we can save on draw calls. Things we want to reuse:

  • cactus
  • payphone
  • walls / building parts
  • signage (maybe its 1 object joined)
  • roads / railroads
  • carriage wagons
  • props
    • barrels
    • rope
    • fencing
    • tables / chairs
@madjin
Copy link
Contributor Author

madjin commented Jun 2, 2023

Proposal: Builder App

There's a ton of building asset kits already: https://sketchfab.com/search?q=building+kit&type=models

Instead of making a new asset kit, reinventing the wheel, I think our efforts would be better spent tapping into the power of real-time collaborative world building that Hyperfy enables with an app that allows us to load asset kits and use them with poweruser keyboard / mouse shortcuts.

  • asset kit loadable from json
    • name
    • thumbnail
    • path
    • stats

User should be able to drag and drop into the world, and have snapping so that pieces can fit perfectly next to each other. This can be done with some keyboard shortcuts as well:

  • Bring up the asset kit with 1 key (right mouse click or tab)
  • 1-4 on keyboard to change factor
    • snap movement by 1, 0.1, 0.01, 0.001
  • Q and E to scroll / rotate
  • Realtime raycast objects to surface

We'll be able to tap into the power of open standards like this gltf-extension for GPU instancing, making bigger worlds that are more performant, and other platforms that utilize this extension will be able to load these worlds in and be performant as well.

@madjin
Copy link
Contributor Author

madjin commented Jun 23, 2023

image
image

@madjin
Copy link
Contributor Author

madjin commented Jun 23, 2023

tldr steps to get instancing to work

  • use duplicate in blender to share geom/mats
  • use gltf-report/gltf-transform instance() function
  • preview in gltf-viewer (gltf-report doesnt have previews for instancing)

can use an asset pallet (see https://github.com/M3-org/base-meshes) to test with, and go from there

@madjin
Copy link
Contributor Author

madjin commented Jun 23, 2023

there's a cost involved in making something instanced because in threejs you have to specify the amount of instances
so if you have 100 completely different models all with "instancing" enabled but theres only 1 of each, that would be horrible

need to be smart about how to go about it in a way that makes sense, like some kind of heuristic that counts how many times an object spawned and shove things >2 into instance

perhaps could add ?instance=true in the asset pallete url so the platform knows to instance? or detect objects after spawning in some kind of manual optimization step for worlds

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

1 participant