Following https://forge.autodesk.com/blog/toggle-sheet-layer-visibility I tried implementing setting layer visibility but the viewer seems to act totally randomly when I call setLayerVisible. There are three possible outcomes:
The layer becomes invisible just fine.
The layer does not become invisible but the layer selector UI shows the crossed over eye.
The layer does not become invisible and the layer selector UI is also unchanged.
Is the viewer functionality buggy or is there something else affecting this? When actually is it safe to call setLayerVisible to get the wanted effect if I want to hide some layers immediately after the model has loaded? Is it when Autodesk.Viewing.MODEL_LAYERS_LOADED_EVENT fires?
Also, somewhat related, the layer selector UI never shows the first layer in the list as hidden even if I click on it to hide it.
Related
Custom objects disappear on every orbit zoom or rotation for about one second, then reappear again when added to a aggregated view in combination with a large model. While the objects are hidden, I can see that there is some reloading/rerendering of the other unrelated model going on.
Overlays (meshes rendered directly into threejs) obviously don't show this behavior.
I'm using viewer version 7.85 and the sample code from here: https://aps.autodesk.com/blog/custom-models-forge-viewer
modelBuilder.addFragment(sphereGeometry, sphereMaterial, sphereTransform);
Is there any way I can prioritize rendering of my custom model or disconnect the rendering from other loaded models?
I would like to be able to draw a transparent object and a completely hidden object at the same time in Forge Viewer.
To do this, I tried to use the following method,
https://forge.autodesk.com/en/docs/viewer/v7/reference/Viewing/GuiViewer3D/#isolate-node-model
It was possible to make objects in the hidden state transparent or invisible, however it was impossible to make the two states coexist.
Is there a way to have an object in two states at the same time?
Yes, it's quite possible.
Activate Ghosting as normal (see settings).
Change some objects to ghosting by setting their dbid with viewer.hide(dbid)
Completely hide other objects using viewer.impl.visibilityManager.setNodeOff(dbid,true) where dbid is the object's id.
This will allow you to have fully visible objects, ghosted objects, and completely invisible objects.
I have a situation where two construction models are loaded in the viewer.
The stair model is moved (whith placement transform) in the building model.
The stair model is now obscured by the building model also behind glass elements
see this gif
Depending on the camera position the stair is visible again.
Viewer is 7.38.1
Typically, when a model is loaded, the opaque objects are rendered first and the transparent objects are rendered last. If you are loading the first model which contains the transparent objects and then the stair model, the transparent objects might be rendering before the stair model. This might be causing this issue.
I would suggest trying the following: load the stair model first and then the model with the transparent objects. If the above statement is correct, this might fix the issue.
In any case, It would be useful to get the repro steps for this and maybe the model assets.
Last, are you using AggregatedView or are you loading the models using Viewer3D#loadModel?
We logged the issue as LMV-5962
As for the current version, I have not found a proper way to detect the zoom start (without overriding the animation function). In my case both movestart and moveend events does not solve the problem.
The actual need for the zoom start is the TileWMS layer. I need to set it to invisible on certain zoom levels. This cannot be set on move end, because at move end the layer still loads tiles from geoserver although set to invisible. Enable / disable property is also not available on the layer itself.
Setting the layer invisible on movestart solves the problem with fetching but on drag already loaded the tiles are not visible :) this is annoying for the user experience.
Is there any other idea how to solve this?
Thanks
I'm playing around with the Autodesk forge viewer and adding custom elements, like it is done in the Autodesk's scene builder example.
I am looking for a possibility to set the "visibility" of one of the new objects - e.g. when moving around the camera, the green cube should remain on it's 3D-position but should not be occluded by any other object (like it is somehow in blue with outline when it is selected). Or maybe even better: if it is covered by another object, it should shine through (with configurable opacity).
Unfortunately after discussing with Engineering it's not yet possible - will continue the conversation to see if we could come up with a workaround for the upcoming releases ...
Like I suggested in the comments try append your geometry to Viewer3DImpl.sceneAfter for the time being (which will be publicly documented and exposed as Viewer3D.sceneAfter in a couple of weeks) or an overlay. Then setting depthTest to false should do what you want...
The choice of sceneAfter or an overlay depends on how you want the objects to be drawn during progressive rendering. sceneAfter is only drawn once at the end of everything else. Overlays are redrawn for each progressive frame...