【问题标题】:How to active "Autodesk.MemoryLimited" Extension in Forge Viewer?如何在 Forge Viewer 中激活“Autodesk.MemoryLimited”扩展?
【发布时间】:2021-03-09 20:52:56
【问题描述】:

我在本地环境 forge 查看器中加载大型模型时遇到问题。

我已经查看了 Autodesk Forge 查看器指南“为大型模型分配内存”(https://forge.autodesk.com/en/docs/viewer/v7/developers_guide/viewer_basics/memory-limit/)

我在查看器配置中应用了“Autodesk.MemoryLimited”扩展,但没有发生任何事情。 指南文档说开发人员和用户可以通过验证左下方的加载栏显示为蓝色而不是绿色,但加载栏没有更改(仍然是绿色)来验证该功能是否有效。

我还加载了“Autodesk.Viewing.MemoryLimitedDebug”扩展。

您有激活“Autodesk.MemoryLimited”扩展的想法吗?

Memory Manager

【问题讨论】:

    标签: autodesk-forge autodesk-viewer


    【解决方案1】:

    不幸的是,该文档缺少一小部分信息。使用 Autodesk.Viewing.MemoryLimited 扩展时,您必须配置您想要施加的实际内存限制,例如,如下所示:

    const config = {
        loaderExtensions: { svf: 'Autodesk.MemoryLimited' },
        memory: {
            limit: 1024
        }
    };
    const viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('preview'), config);
    

    另外,请注意,内存限制加载将在您的模型大于配置的阈值时启用。如果您想强制限制内存加载,即使是较小的模型,试试这个:

    const config = {
        loaderExtensions: { svf: 'Autodesk.MemoryLimited' },
        memory: {
            limit: 1024,
            debug: {
                force: true
            }
        }
    };
    const viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('preview'), config);
    

    编辑

    memory.debug 对象可以包含自定义内存限制加载行为的附加属性。这些是供内部使用的,但您也可以尝试使用它们:

    options.debug = {
            // Increase the max page out size. On slow (mobile) devices the scene
            // traversal is a bottle neck and making this larger helps load more
            // pack files earlier in the load.
            maxPageOutSize: 195,                                // Max we will page out in one go
            pixelCullingEnable: this.options.onDemandLoading,   // Useful with on demand loading
            pixelCullingThreshold: avp.PIXEL_CULLING_THRESHOLD,
    
            occlusionThreshold: 1,
            occlusionTestThreshold: 1,
            startOcclusionTestingPackCount: 8,
            testPackfileCount: 4,
            useOcclusionInstancing: true,
            automaticRefresh: true,
            boxProxyMaxCount: 0, // show this many boxes during a render
            boxProxyMinScreen: 0.4 // if entire render batch is >= 1/10 of the screen in area
        };
    

    【讨论】:

    • 感谢您的回答!答案正是我需要的!看完你的回答,我还有一个问题。我可以控制内存管理器调试选项,例如“UploadPackfiles”吗?在“自动刷新”的情况下,我添加选项“自动刷新”来调试对象,它正在工作。
    • 很高兴我们能帮上忙!是的,memory.debug 下还有更多选项。这些更多用于内部使用,但您也可以尝试使用它们。让我将它们添加到答案中。
    猜你喜欢
    • 2020-05-14
    • 2020-10-30
    • 2022-11-10
    • 2019-11-20
    • 1970-01-01
    • 2021-05-01
    • 2020-09-05
    • 1970-01-01
    • 2021-02-19
    相关资源
    最近更新 更多