near and far calculation in Autodesk Forge Viewer - autodesk-forge

In Forge Viewer, the near and far calculation is done in an internal updateCameraMatrices method. In that method, there's a final heuristic to fine-tune the near value better near line 31320:
// One more attempt to improve the near plane: make it 1/100,000 of the distance of the
// far plane, if that's higher.
// See https://wiki.autodesk.com/display/LMVCORE/Z-Buffer+Fighting for reasoning.
// 1e-4 is generally good below, but inside Silver Cross we get a lot of near clipping. So, 1e-5.
dMin = Math.max(dMin, dMax * 1e-5);
In some BIM models I load in the viewer I can see Z-fighting for some viewing angles. If I change the value from 1e-5 (1/100,000) to 1e-4 (1/10,000) as noted in the comments, the z-fighting is gone.
This also seems like a much more appropriate value for large models (like buildings). It's maybe less suited for small-scale models like 3D CAD models.
Can I safely change this value to 1e-4 if all I intend to render is models in the scale of buildings (from Revit, Navisworks etc)?
Will the Forge Viewer allow to configure the near/far calculation in its API?

I'm afraid that you shouldn't modify this value directly in the viewer3D.js file. It's not recommended to do so. There also is no such API to modify this value as I know.
However, have you tried to change the bounds of the viewer? Here might be a similar case you can refer: Adding a skybox
If this doesn't match what you need, could you provide some snapshots and more detail information demonstrating this issue to me? If you do so, I 'm glad to pass it to our engineering team for further investigating. You can send those materials to forge.help#autodesk.com if it cannot be posted publicly.
P.S. Please remove confidential information from anything you sent to us.

Related

Is there a reality capture parameter to request the desired number of vertices?

In the previous reality capture system users could set a parameter which would determine the resolution of the output models. I want to wind up with models about 100-150K vertices. Is there a setting that allows me to request the modeler to keep the number of generated vertices within some bounds, somewhere in the forge API?
The vertex/triangle decimation is usually, what can be called "subjective" task, which can also explain why there are so many optimization algorithms in the wild.
One type of optimization you would need and expect for "organic" models, and totally different one for an architectural building.
The Reality Capture API provides you only with raw Hi-Res results, avoiding "opionated" optimizations. This should be considered just as a step in automation pipeline.
Another step, would be, upon receiving, to automatically optimize the resulted mesh based on set of settings you need.
One of these steps could be Design Automation for 3ds Max, where you feed a model and using the ProOptimizer Modifier within 3ds Max, you output the mesh with needed detail. A sample of this step, can be found here: https://forge-showroom.autodesk.io/post/prooptimizer.
There are also numerous opensource solutions which should help you cover this post-processing step.

IFC conversion method changes position of resulting SVF

When converting IFC files to SVF with the Autodesk Model Derivative API, I would like to start using the "modern" converter instead of the "legacy" one. However, when using Forge Viewer, the models that were created with the modern conversion method end up with a different position and/or orientation than the legacy ones.
I have tried to get to the bottom of what the difference consists of, and it seems to at least have something to do with the TrueNorth property of the IfcRepresentationContext in the IfcProject. Also, the ObjectPlacement of the IfcSite is probably part of it. But I haven't found a combination of properties to reliably compensate for the difference for all my IFC files. The IFCs typically come from Revit, but may have various origins.
Many of our customers have projects with several existing models, so ideally, any new models should align with the existing ones even if the conversion method has changed.
I submitted an issue item NWLMV-164 on your behalf to ask our engineering team to allocate time to investigate it. Now it can be traced back to NWLMV-88. As result, it needs some time to explore and find the solution to fix this issue. Please take a note of either NWLMV prefix ids. You're welcome to track updates in the future by sending an email to forge[DOT]help[AT]autodesk[DOT]com quoting the NWLMV prefix ids. We appreciate your understanding and patience.

Autodesk Forge randomly loses object and room information

I'm using Autodesk Forge to integrate with our remodeling tool. In particular, I need to count objects of different families and types and determine to what room they actually belong. I use Model Derivative API for this purpose. To keep the room/area information I convert .rvt files to .nwc files as suggested here. However, when I retrieve data with GET /modelderivative/v2/designdata/{urn}/metadata/{guid}/properties I face the following problems from time to time:
Room information sometimes disappears from Objects for some reason
Objects disappear from result data for some reason (but they seem to exist when I browse them in A360)
I have no idea, what can be the reason for this.
I have no explanation for the disappearance of room data or objects for you.
If you can provide a reproducible case demonstrating that, I will gladly pass it on to the development team for analysis.
If you are interested in an immediate reliable solution and full control, which I assume is the case, I would suggest following the second bullet item in the advice provided by Eason in the previous answer that you refer to above:
Extract all the room information and object relationships you are interested in via the Revit API, store that data somewhere yourself, and use it later on wherever you like to your heart's content.
Then you will be completely safe and independent of all other components and their unpredictable behaviour.
If the only information that you need is the room containing each family instance, I can even implement a suitable Revit add-in for you.
Another suggestion that might help, if that is indeed the data you require: determine that information in a Revit add-in and attach it to each family instance in your own personal shared parameter. That will ensure that it remains intact through the translation process. Afaik, all shared parameter data is retained, independent of other behaviour.

Live Map Directions while traveling

I'd like to create a route from point A to B.
I'd like to show the current position of the traveler on that route line.
If the traveler deviates from the route I'd like to update the route to compensate realtime.
Basically what Google maps does but I'd like this in my own application.
I looked at Google and Bing Maps API and nothing seems very intuitive.
Whats the best way of doing this?
Logic:
Depending on what you're trying to achieve and most importantly, how you plan to implement those features, you might consider doing it in two steps.
1/ Generate a basic route and create a buffer around
To generate it, use the platform of your choice and retrieve the geometry that you will be able to use to generate
2 / Detect if it get out of the original buffer and generate a new route and go back to step 1
Once you get the buffer, your regularly (based on your location events for example) check the intersection with the buffered route, if it's out of the buffer, then you recreate the route and so on.
Implementation:
In order to do this, you might be interested in using Turf library, see this example:
http://turfjs.org/examples/turf-buffer/
Combined to Within() method:
http://turfjs.org/examples/turf-within/
Turf is available here:
http://turfjs.org/
Consideration
Be careful though regarding the terms of use of each platforms as you might not do driving/navigation application depending on the cases and platforms you want to implement.
You might be able to implement it quite easily, there might be something you can add to optimize accuracy (like bearing to the next geometry location, speed profile...), but I'm sure it will cover at least 90% of your needs based on the described case.

Visualizing large quantities of data on google maps / visualizations

I have a json file thats roughly 480mb of geolocation points. I was wondering if someone knows of a good 'pattern' to use when trying to visualise the data. The problem I'm encountering is that the data has to be loaded into Google maps from the get go. This is causing all kinds of obvious issues.
I don't have to do this through google. It just seemed like the obvious choice.
With that much data, it may make more sense to handle it on the server side instead of client side. You could set up Geoserver with your appropriate data points. Using OpenLayers, you could overlay your points from Geoserver on top of Google Maps or potentially even on top of your own map if you want to cut out Google Maps all together. The heavy duty processing then happens on the server and only images are displayed in the browser. This cuts down on network traffic and the amount of processing the browser has to do. If you set up Geoserver to do caching, the server won't even have to work very hard.
It really depends on what kind of data this is.
If these are points for polylines or polygons you might try to encode the points (http://code.google.com/apis/maps/documentation/utilities/polylinealgorithm.html and http://code.google.com/apis/maps/documentation/utilities/polylineutility.html). There are also functions which you can use to encode the points. This will significantly reduce the size of your data.
You might also want to consider loading data depending on zoom level on the map. (I am not sure what you mean by "data has to be loaded from the get go" - you can load the data into the map depending on events, etc...) .
Fusion tables mentioned above will only accept 100MB of data.
I can be more specific if you explain the nature of your data and what you trying to do in more details. Hope this helps.
Try Google Fusion Tables