Can transparent and hidden objects coexist in Forge? - autodesk-forge

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.

Related

Forge viewer Display anomaly

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

Setting layer visibility in Forge viewer

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.

Autodesk Forge Viewer: how to set object occlusion

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...

Correct way to do the image annotations for mask R-CNN

I want to annotate images for Mask R-CNN. Mask R-CNN creates a separate annotation image for each labeled "object" in the image, this generates some cases, which don't happen in other image segmentation networks.
Objects with two disconnected components
Objects which are separeted in the image, it can be, because the object itself consists on two or more discontinuous polygons, or because the object is partially occluded by another object, which creates two or more different components.
How should these objects be labeled?
- If each part is labeled disconected from the other, then two different annotation images are going to be created, and the form of the object is going to be lost.
- If the object is labeled over the occluded object, the image of another object is also going to be labeled as the object.
- Should occluded objetcs be avoided in the images?
Object borders interceptions
Whe the labeling isn't precise, the labels of some objects superpose, this is not a problem for other algorithms that use only one annotation image, but for Mask R-CNN, when the polygons superpose it may cause unconsistent labeling, because in one annotation some pixels will be labeled as one object and in other annotation as another object.
Should the images always be "perfectly" labeled, or "underlabeled" (when one label keeps a certain distance from the next labeled object)?
Objects with holes
The labeling of these sort of object may be a problem, depending on, if the software used for annotating the images allows to create objects with holes. Or if the holes are just background covering a part of an object, in this case, there would be an annotation image with the hole belonging to the object, and another one belonging to the background.
Is there another way to label objects with holes?
I want to know, how should I annotate these images to obtain the best possible results.
Thanks

How to zoom and pan a gameobject not the whole scene in unity

I have several images in my scene, I managed to make the zoom and pan work but the problem is, All of the images are zooming in at the same time. The scripts are place on each gameobject. I used gameobject for the images.
You need apply a filter so you just appli the transformations to one game object, since every one of them are GameObjects I recommend use raycast to sellect an object and then activate his Zoom.cs script just for this object.
I sugest to use just one Zoom.cs in the scene instead of every object having his own copy, then change your function to work with one game object as a paremeter and, when you touch your game object then that object will be the one to suffer the transformation.
If you doesn't want to implement a raycast or change your function at all, then you could set all the images inside a matrix, or use an index system, the central image, or the index you designed, will be the one to suffer the transformations. so you can scroll betwen your gaery and be sure that just the image that you designate in your matrix/index will be the choosen one. The trouble here is that you need to fully control the scroll animation so no one of the images will be in a wrong place like in between two index.