问题
I want to add environment map for background,I have tried viewer.setLightPreset(value) ,but I don't like the default map.I need to add custom environment map for background.I learned about Add Custom Light for the View and Data API Viewer,and added this code in my viewer
Autodesk.Viewing.Private.LightPresets.push({
name: "selfEvn",
path:"selfEvn",
type:"logluv",
tonemap:1,
E_bias: -2.0,
directLightColor: [0, 0.84, 0.67],
ambientColor: [0.8, 0.9, 1],
lightMultiplier: 0.1,
bgColorGradient: [230, 230, 230, 150, 150, 150],
darkerFade: !1
});
viewer3D.setLightPreset(Autodesk.Viewing.Private.LightPresets.length - 1);
Forge's file is used with the dds suffix file.I made the dds suffix file width NVIDIA Texture Tools for Adobe Photoshop,and put it under this path: res\environments.But viewer can't use my file.I opened the defaulet files under the path: res\environments,they are just look like this Default files.I don't know if my method is wrong or my files are wrong My files are just like images,but their suffix is DDS. And my model was created by Revit
回答1:
After checking with the dev team, there is no API available for converting and setting user owned background image (Environment map) for models from the Revit and the Model Derivative translation currently. Custom background image feature is only available for models of the Autodesk Fusion 360, but there is a known issue for image translating from the Fusion model which is investigated by the dev team now. We apologize for any inconvenience caused.
In addition, we cannot ensure the certainties and the stabilities of those private APIs. Private APIs are only for the internal usage of the Froge Viewer. Therefore, it's not recommended to use those APIs under the Autodesk.Viewing.Private
namespace to partner developers like you.
However, we can log this request in our internal system for the dev team to allocate time to investigate. Maybe it will come true someday, but we have no idea when it will be. So, there is no any promise for it. Hope you will understand.
来源:https://stackoverflow.com/questions/45156353/how-to-add-custom-environment-map-for-background-in-autodesk-forge