How to create a .usdz animation? - scenekit

You can now convert 3D models to .usdz files (uncompressed zip archive) using Apple's command line tool bundled with Xcode 10 beta.
Example code to convert an .obj file to .usdz:
xcrun usdz_converter magnifying_glass.obj -g frame magnifying_glass.usdz
-color_map gold-basecolor.png -normal_map gold-normal.png
-roughness_map gold-roughness.png -metallic_map gold-metallic.png
The following input 3D file types are supported:
OBJ file
Single-frame Alembic (ABC) file
USD file either .usda (ascii) or .usdc (binary)
It's my understanding the OBJ file does not support animation natively.
A single-frame Alembic file won't support animation either as its a single-frame.
So I'm guessing you need to use usda file which link to a sequence of single-frame Alembic or single-frame OBJ files to generate animations.
Is there any Publicly Available documentation on how to go about this?
A usda file can use payload files to reference single-frame meshes. The example below references a Treasure Chest single-frame alembic file geometry.
#usda 1.0
def "Chest_Base" (
references = [ #./Chest.abc#</Chest_Base> ])
{
}
But I haven't found any concrete way of linking a sequence of .obj or single-framed alembic .abc files together to create say a 10-second animation.
Any help or hint would be greatly appreciated.
Edit 30th June:
I’ve now managed to animate a USDZ file. I’ve got a live demo here of a rotating gears and helicopter.
Basically, I needed to download the usd pipeline from github and build it on my mac. You can get good instructions on how to do that from here
Be warn set aside at least a couple of hours, the build itself takes about an hour.
After that i ran the animated tutorial example in the usd pipeline bundle. Step5.usda (ascii usd file) has an animation example which I followed to create my own animations using rotations.
Running this usdz command will create a simple animation of a spining top if you create the Step5.usda file following the pixar tutorial at the link above.
xcrun usdz_convertor Step5.usda animationTest.usdz
Edit 10th July 2018:
usdz also supports alembic assets (with animations).
I have now managed to get a simple animation working in usdz (using the alembic file format). However, a bone animation on a character I tried didn't work.
I exported Alembic assets with both the Blender & Modo Alembic exporters... same results.
UV materials were also not mapping correctly to the mesh. Something wrong with the uv scaling & mapping... materials come out fragmented. At this stage I don't know if this is a bug, or whether I'm not doing something wrong here. There is some discussion about this uv mapping issue on the Apple forum
Edit 8th Sept 2018:
This is a rapidly evolving area and I'm sure more ways to tackle usdz animation creation will appear over time. However, at present the best & least costly way (open source) to make transform, bone, blend-shape or morph animations usdz files is using a command-line tool hosted on GitHub called glTF2usd.
The tool can convert a glTF animation file into a usda file (the intermediary file type) for creating the usdz file. It should also support direct usdz creation shortly, negating the need to use Apples usdz_converter command line tool to go from usda -> usdz.
Only currently supports 1 animation group. Some bugs still exists regarding rotations, --use-euler-rotation handle can be used to help with smoother rotations.
I've been posting usdz animations I have been creating with the tool to an online usdz gallery www.fusionar.app

Updated: October 16, 2022
USDZ with Animation
You can easily import, animate and then export binary and ascii USD, models from Autodesk Maya 2020 | 2022 | 2023 with pre-installed Maya USD plug-in. All you need to do is to know how to animate your model in Maya (whether it's Asset Animation or Transform Animation), the rest is as easy as saying "cheese".
Read this post to find out how to unzip a USDZ model.
Read this post to find out how to zip a USDA/USDC model.
Also, simple Transform Animation for USDZ models is possible in Apple Reality Composer.
For that, just drop USDZ model into Reality Composer's scene, apply any behavior you need and then export a result as USDZ file.
However, Transform Animations are programmatically available in RealityKit.
In SceneKit, unlike RealityKit, the animation in USDZ model plays automatically, as soon as the model is loaded. In SceneKit, don't forget to activate the autoenablesDefaultLighting = true option.
USDZ Schemas
If you like Python scripting you can apply simple Transform Animations using USDZ Schemas.
FBX with Animation
After creating an animation in Maya 2020 | 2022 | 2023, bake your animation using menu:
Edit -> Keys -> Bake Simulation
After that you can alternatively export your scene as .fbx:
File –> Export All (option box) –> FBX Export (dropdown menu)
Now it's time to prepare your .fbx file for Xcode 13/12/11 using the following Terminal command:
usdzconvert ~/Desktop/model.fbx -v
If you're using Xcode 10, a command in Terminal looks like this:
xcrun usdz_converter ~/Desktop/model.fbx ~/Desktop/model.usdz -v
A detailed description of how to work with the usdzconvert command in Terminal you can see HERE.
And of course, Reality Converter is an easy way for those who prefer GUI:

Now Apple provided a much easier way to convert almost any file (I would recommend using glTF/ glb as export option in Blender):
Reality Converter
It is a simple GUI tool released in January 2021, where you drop your files onto and it will give you a usdz file. Including mesh, materials and animation. For the download you need an Apple developer account.

I had an character with a simple armature animation in .fbx file, and I used "Reality Converter" by Apple to make it into a .usdz file that contains the animation. The animation even works in "Reality Composer".
The link for Reality Converter can be found here.

Related

Batch export raster layers with underlaying other layers to PNG using same layout (ArcGIS Pro)

I wouldn't ask if I had not searched a way for the whole day - so my problem is, that i have multiple raster files (>300) that show different flooding of cells in each iteration step (so not strictly a time series, but close). I want to display the results on a hillshade (that remains the same) of every raster and export it to a png. My goal is to animate them using one layout in ArcGIS Pro, where only the active raster layer should change on every export and then animate the exported png files to one GIF or video file!
How is this possible in ArcGIS Pro 2.8?? Or QGIS?
ArcGIS Pro Animation tools are not working for this scenario (because I dont have feature classes and/or time series data) and QGIS seems to only work with change of extents in Atlas (or time series with time data as well). In ArcMap there used to be a tool called Group Animation, which does exactly what i want to do ...
Any ideas? Maybe a python script? Any hints on that?
Very appreciated!
Max
I have tried out the ArcGIS Pro Animation tools which apparently need time series data or feature classes (which I dont have). QGIS Atlas also seems to only work with varying the extent of the image on every iteration...

ArangoDB Graph Viewer Options: Label using more than one attribute

In Arango's Game of Thrones example dataset, they show a graph view where character nodes are labeled with two attributes: name and surname. How is this done?
Arango graph viewer example with Game of Thrones character data
The help doesn't explain it.
Graph Viewer Options
Nodes Options Menu:
Label (string): Nodes will be
labeled by this attribute. If node attribute is not found, no label will be displayed.
That makes it sound like only a single attribute can be used, yet their example shows the use of two attributes.
Luckily it's ArangoDB open source, so it's possible to achieve it and quite easily
here's quick and dirty commit adding such a functionality
to test it, not deploying it into production as it can cause unexpected security issues
clone on linux https://github.com/pavelsevcik/arangodb, cd into it, switch branch to feature/graph-viewer-config-labels--quick-and-dirty and run
cd js/apps/system/_admin/aardvark/APP
npm install
npm run grunt
mv node_modules ..
zip -r ../app.zip .
mv .. /node_modules .
then deploy created js/apps/system/_admin/aardvark/app.zip via services > add service > upload > set mount point to /aardvark
then change in url _admin/aardvark to aardvark and test it
here's Feature Request: Support of multiple attributes for displaying labels in Graph Viewer
The Graph Viewer does not support multiple attributes for displaying labels.
I took a screenshot of the graph without any labels and edited it in Paint.NET, that's the whole secret. This was for full control about the font face, size and placement. This combination was the easiest way to do it when I wrote the AQL tutorial.
Feel free to open a feature request on GitHub nonetheless.

how to export a mapbox studio map as .mbtiles file

So I'm guessing the answer to this is "no", but is there any way to export a map I've designed online with mapbox studio (https://www.mapbox.com/studio/) into a .mbtiles file so I can host it myself?
Honestly, I'd be willing to pay money for this (saving me the trouble of getting a world .pbf file and getting it into a postgresql db is really a pain, especially with a mediocre computer like mine)
It sounds like maybe there used to be a way to do this, but as of now it looks like they've taken away this ability. I can see a lot of different ways to use a map I've created, but everything forces me to use mapbox as the hosting service... it seems there's no way to download a map I've created.
I think your assumption is correct. It does seem MapBox wants you to use their APIs and API keys.
However, there is a partial solution with raster tiles if you can fallback to that. Or you can get vector mbtiles from OSM data instead of from mapbox servers.
mapbox offline support for android/ios
I've contacted mapbox support in April 2017, and what I've been told is that although the style files that you can download from MapBox studio don't contain tiles, there's a way to have them render offline on Android/iOS.
If you would like to use Mapbox maps offline, you would need to follow the examples shown for Android or iOS, depending on your platform. Essentially, the mobile SDKs take in a style URL that points to your custom style created in Mapbox Studio, and the SDKs handle the downloading of all other resources needed to keep the map offline (fonts, icons, tilesets, etc). Check out our guide on offline maps to read more about how this works.
Links:
Offline Maps with MapBox
Mapbox Android-SDK Offline example
Mapbox iOS-SDK Offline Example
From a quick look at the example code, it would seem that the downloading of the tiles is done within the App, but done ahead of time, for instance just after you install the app and you still have
network connectivity. I don't immediately see whether or not your Mapbox API keys are involved at all in this download, with respect to your billing concern. There is a 6000 offline tile limit per offline region.
Not for desktop: The site also mentions that offline is not an option for MapboxGl-JS, so you'd have to hack it up to make your offline region available on desktop web browsers.
mapbox studio export as mbtiles...
There was supposedly a non obvious option in settings to download your source as an mbtiles file in mapbox studio classic. A mapbox classic issue on github has a screenshot of where the button should be. It's possible that option is gone now.
That github project, https://github.com/klokantech/vector-tiles-sample, provides links to projects/tools that can break the mbtiles file into its contained pbf files, which are a protobuf compressed format for each vectorial tile (https://github.com/mapbox/mbutil). Slightly outdated.
An approach which might otherwise work, is to cache the network requests ahead of time for each tile retrieved from MapBox, and then in your APP proxy the requests to your cache. I'm not sure whether that's against the ToS though. You'd probably have to do it programmatically with all XYZ coords you wish to cache.
Taking a dive with tippecanoe to produce vector tiles
You can create vector tiles with tippecanoe (and host them yourself). It's not MapBox, I know. But it might get your farther in the long run.
Nice short blog article about it: http://fuzzytolerance.info/blog/2017/02/02/Making-your-own-tiles-with-Tippecanoe/
The mbtiles you create, you can layer them, and possibly style them with the open source maputnik (which is somewhat like the style editor of mapbox). Then you take serve mbtiles with your own server, and plug in your style into mapboxGL-js or openlayers.
TileMill -- (.mbtiles with raster tiles) fallback
There is TileMill which is still available (but deprecated), runs on the desktop, and will allow you to create maps from shapefiles (e.g. you can get openstreetmap shapefiles for single cities at https://mapzen.com/data/metro-extracts/ ).
TileMill, will give you a mbtiles file at the end of the process. Although, that mbtiles contains raster tiles, not vector tiles. Vector tiles can be styled dynamically so it's nice on mobile when you want to accommodate various situations with fonts or adapt lighting.
Raster tiles might suffice, because in your app you probably will be able to render other interactive objects on top of that base layer. OpenLayers is one portable framework where you'd be able to do that, for instance -- allowing the user to draw objects or click points of interest that you've loaded from a database separately from the map data.
Get OSM-based vector tiles instead of mapbox
There seems to be an alternative maker of Vector tiles now, http://openmaptiles.org (used to be http://osm2vectortiles.org ).
You can go here, and download an mbtiles file for a city of your choice for instance: https://openmaptiles.org/downloads/#city , then serve that file (locally) for your app with a tile server. (or use one of the tools mentioned above to break it into the individual pbf files and read the files from local disk / memory)
With this approach, you combine a vector mbtiles from OSM, with the style you've created in mapbox studio (mapbox studio lets you download a zip file with your .json style in it), and you can still use MapBoxGL to display it.
There's Maputnik http://maputnik.com/ which you can use to edit a mapboxgl style file (the editor works with local storage). and there's presumably https://github.com/boundlessgeo/ol-mapbox-style which allows you to convert that style into a piece of code suitable for OpenLayer's style API.
As far as I know Mapbox does not provide map downloads. You could download vector maps directly using their vector tiles API and be charged against your vector tile count. 200K tiles are free per month. In my experimentation, 80K tiles represent about 200 sqaure km of area. So you'd run out of free tiles very quickly for large areas and would have to pay 1$ per about every 10km more of square km area. (all very approx values based on nominal observation). Also, these leaves the challenge to actually package the .mvt files into a MBTiles format.
I suggest an alternative way instead.
You can create MBTiles from any .osm.pbf file using this tool - https://github.com/systemed/tilemaker
Download .osm.pbf file from Geofabric. To download for a custom area, you can use Protomaps or BBBike Extract
Download tilemaker
Execute the following command
tilemaker --input netherlands.osm.pbf --output netherlands.mbtiles --process resources/process-openmaptiles.lua --config resources/config-openmaptiles.json
You can read more about it in this blog post - https://blog.kleunen.nl/blog/tilemaker-generate-map
To use the same style that you created in Mapbox Studio, you can download your style's JSON file by clicking on Share -> Download. This zip will contain your JSON file which describes all the colors, etc you customised.
If you are planning to show this MBTile on Android app, you'll just have to embed this JSON that you downloaded and the MBTiles file in the app and point the JSON to the MBTiles file. I've written how to do this in this blogpost. I tried to make the JSON work but only partly succeed after some edits. However ideally it should work since its based on the openmaptiles schema.

FBX import crashing UE4

Exporting from Maya to UE4 is causing the UE Editor to crash with no explanation. The submit error report dialog appears but there is no useful information available.
I have tried changing the FBX Version as some posts suggest, however, this does not seem to help.
How can I go about addressing this issue?
When exporting make sure the base model is in editable mesh and not editable poly and make sure the FBX exporter is set to ASCII not Binary.
This happened to me on 3ds Max, I am not a maya user
i had recently come across with the same crash... while importing from fbx
from mixamo and maya what worked for me was....while exporting fbx i had done the resetting of fbx preset to autodesk media and entertainment and switched off the smoothmesh option and enabled the Triangulate..
please do delete the unused nodes before exporting and keep no group nodes above the mesh or skeleton...
hope that helps those encounter similar in their workflow
as i was doing the following test projects this error occurred and crashed...
Project link1 : https://youtu.be/OsvZ1cpBBf0
Project Link 2: https://youtu.be/sXMrTkPiVEM
enter image description here

WPF to XPS to PDF

I have implemented a report in standard WPF controls and have also implemented a DocumentPaginator to take these controls and convert them into a document for printing.
I have also implemented some code which uses the document paginator to render the pages to images and write them out to a PDF using PDFSharp, however this does not allow for copying and pasting, also the image quality is questionable.
I have experimented with the GhostXPS utility and was thinking of using it by saving out to an XPS document and then using GhostXPS to convert it to a PDF, this was promising, however the current version contains a bug that renders data copied from the generated PDF useless...
So I thought I would ask here to try and find a efficient method for doing this, Can someone please suggest a good way to take a DocumentPaginator and either save it directly out to a PDF, with copy/paste functionality or convert it from an XPS document to a PDF with this functionality?
Thanks,
Alex.
EDIT - PDFSharp fix:
Ok as requested here is what I did to compile the fix for the PDFSharp 1.31 XPS converter:
1) I downloaded the source from here:
PDFSharp - SourceForge
2) I followed the instruction in this post:
PSFSharp Fix
XpsParser.ImageBrush.cs (ln 22, added): brush.Opacity = 1;
PdfContentWriter.cs (ln 526, changed): if (opacity <= 1)
3) Then just compile the source, first open the 'PdfSharp-WPF.csproj' and build that, then open the 'PdfSharp.Xps.csproj' and build it as well, the relevent libraries are 'PdfSharp-WPF.dll' and 'PdfSharp.Xps.dll'
Note upon trying to build the source you will likely receive a few errors depending on which version of .NET you are targeting, these are simple to fix if you just read the error messages.
EDIT(2): NJones created a blog post with more details on the PdfSharp fix: Output to PDF in WPF
There is an XPS Converter that was included with PDFsharp 1.31. It's a beta version, but AFAIK it supports nearly everything and may work for your needs.
PDFsharp 1.31 can be downloaded from SourceForge or CodePlex.
If a commercial SDK would be an option, there is one company I came across that has a professional XPS to PDF conversion option (and more).
http://www.nixps.com
Warning: I'm not affiliated with this company nor have I tried their products. I have on the other hand heard good things about them.
I use Telerik Reporting which handles document pagination and allows you to create reports in a designer similar to creating a GUI. I decided to just buy a 3rd party product because I didn't want to spend development time writing my own paginator, etc. Also, this tool is probably more bug proof then a custom solution and allows a lot of flexibility for how you want to design your printout/report. In the future if you have more complicated printing or reports required, this tool does a lot more. I do not work for Telerik, but there product is good.
It allows exporting to PDF, Word, Excel, HTML, PowerPoint, PNG, etc. etc.
IMHO, you've got the right idea: XPS is, in my mind, the simplest method of serializing the data into a usable format, especially for conversion.
As for a third party tool, I've a peer (as in, not myself,)who's used CheckPrixa with some measure of success; it's freeware and it offers command line conversions. (i.e. serializing a document and converting a la generated .bat file.)
It also allows you to handle keywords, titles, etc. along with more important items like even pagination.
As far as I'm aware, there are no known discrepancies.
Alternatively, if converting the MSXPS is what's giving you headaches, you might want to look at XpsConverter, it converts MSXPS to OpenXPS, and as a Window's driver, it's available on any machine using .NET 3 and above.
Keep us updated with whatever solution you try, virtual reports are a growing deal.

Resources