vircadia / vircadia-native-core

Vircadia open source agent-based metaverse ecosystem.
https://vircadia.com/
Other
533 stars 174 forks source link

Entities: Add LOD and Load Priority properties to entities. #1709

Open digisomni opened 1 year ago

digisomni commented 1 year ago

Summary

LOD

We will be adding a few properties under a "LOD" object for the "Model" entity type.

lod: {
    mode: 'auto' // 'auto' or 'manual', if auto then the levels are disregarded and the engine / client's auto LOD system is used.
    levels: [
        0: { url: 'https://google.com/mymodel-slightly-decimated.glb', distance: 5 }, // Can use a new URL for separate models
        1: { url: 'https://google.com/mymodel-very-decimated.glb#NewTree_LOD1', distance: 10 },  // Or you can access the index on that model
        2: { url: '#NewTree_LOD1', distance: 25 } // This will access an index relative to the main model URL for the entity without having to repeat a URL
    ]
}

Engines

Load Priority

loadPriority: 43

This property is applied to all entity types. It is a number from 1-255 (or whatever a good max integer is for the packet). This property is utilized by a client to determine which asset should be downloaded and loaded first.

ctrlaltdavid commented 1 year ago

If auto, which level URL should be passed onto the engine - always URL 0? Load priority values:

digisomni commented 1 year ago

I think loadPriority should be from lowest to highest, so 0 means load first, 255 means load last. And yup, I picked that range because it fits well for optimized networking. 😊

Auto means use automatic LOD systems, with Nanite that means it automatically scales assets, with Babylon.js it will do the same. There may be systems that try to auto select based on URLs, that would be documented so the user knows to fill in URLs as well as set it to "auto" if they want that feature to work in that specific client/engine.

Aitolda commented 1 year ago

Kalila asked me to move this from another issue I made.

This is how LOD would work ideally for creators who use tools like blender. I've created 4 LODS for an object (two objects technically), with LOD0 having the full amount of polygons (full detail), and LOD3 having the least. They way LOD typically works is at a certain threshold (specific distance) from the camera (not to be confused with the avatar) the system would automatically choose to render a lower LOD, and even further beyond a lower LOD until it reaches LOD3.

LOD

Notes on implementation can be found here

Why do we want this? I already have a simple script that will generate these LODs with 1 click on any object in blender. If our system can be made to simply recognize the "_LOD1, _LOD2, _LOD3, _LOD3 of any objects in the glb it will make it VERY easy to create large detailed environments.

digisomni commented 1 year ago

I've updated the spec accordingly, so it should be able to handle both cases now.

Aitolda commented 1 year ago

LOD example prototyped in Blender Video is 2 minutes long. Be sure to unmute

https://github.com/vircadia/vircadia/assets/21160271/b099e8fb-768b-46f9-8de8-d6c84b0a4cc7

stale[bot] commented 8 months ago

Hello! Is this still an issue?