如何在 Forge Viewer 中激活 "Autodesk.MemoryLimited" 扩展?
How to active "Autodesk.MemoryLimited" Extension in Forge Viewer?
我在本地环境 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.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
};
我在本地环境 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.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
};