Parse/Convert Xdata to other formats and FBX

 

Let's say there is already a recorded xdata file with tracking data.

1. Is there a way to script or write a program to convert the recorded data to other formats? (ASCII formats, but non standard)

2. Is there a way to convert a recorded xdata to FBX? What about the distortion data for stmap?

   jim4586

 
Profile Image
Eifert@Aximmetry
  -  

Hi Jim,

There is no program or script for it.
You could have recorded the camera using the Tracking Recorder module or the Record_3-Audio.xcomp compound. I guess, now you could do the same by playing back the xdata with the camera compound and recording it with the Tracking Recorder module. Sadly, you will only be able to do that at real-time speed.

Note, when recording with the Tracking Recorder module or the Record_3-Audio.xcomp compound, there is an option to save it in ASCII. So you will be able to edit and read the generated file even with text editors:

In the next release of Aximmetry, you will be able to record focus data too with the Tracking Recorder module.


If you are referring to Nuke's stmap: https://learn.foundry.com/nuke/content/comp_environment/lens_distortion/analyzing_distortion_grid.html
Then I guess the following setup could generate the distorted checkerboard image from your tracking data:

And Nuke could use the checkboard image to generate the stmap.

Warmest regards,

 
Profile Image
jim4586
  -  

Would it be possible to publish a format spec for the Xdata format so other programs could read it for example?

how would you actually create the stmap files? It’s a UV source file with red and green gradients that get distorted that’s all. But it needs to be 32 bit float for sufficient precision instead of 16 bit. That’s how it’s done and how distortion data can move between tools since for example FBX cannot deal with distortion and renderers usually don’t do the distortion. So you render with a 3D render and then distort the image with the stmap in compositions eg with Nuke, Flame, Aftereffects or Davinci. They all support distort and undistort stmaps.

there is two types of stmaps. “Undistort” and “re-distort”.

These gets stored as 32 bit RGB EXR. That’s how all the VFX compositing is done in post to combine CG and live footage plates.

hope this helps.

 
Profile Image
Eifert@Aximmetry
  -  

Hi Jim,

We added the public specs or readable Xdata format to our request list.


I am not sure that Nuke, Flame, After Effects, and Davinci use the same format for the stmap. Like DaVinci Fusion's Lens Distort node can output a Distortion map which will be in a different format.
Also, it seems to me that only Nuke refers to this as stmap. In other software, you can just use similar maps with various other features (UV Map, Displacement Map) to achieve the same or similar effect.

In Nuke, you could make a stmap, using the modules in the screenshot in my previous comment and using this guide: https://learn.foundry.com/nuke/content/comp_environment/lens_distortion/analyzing_distortion_grid.html

Also, I think all these software have the option to use actual lens distortion data as DaVinci Fusion's Lens Distort node does. And using such methods will result in better quality end results. I added it to our request list to make such conversions possible or have a document about our lens file explaining it how to use it with other software.

Note, every zoom level has different lens distortion. So for example your stmap would only work at a fixed zoom level. And when the zoom changes you probably need to animate between two stmaps.

Warmest regards,

 
Profile Image
jim4586
  -  

Every VFX production uses stmaps. It’s the STANDARD. It allows to transfer lens data without requiring the same lens models between softwares. Just make sure you save them as EXR32. All those packages read them and can use them the same way.

Exporting lens grids is not the way to do this…

zoom is rarely used on feature film with post. Mostly primes.

 
Profile Image
jim4586
  -  

By when do you think you could provide the Xdata format spec? We have a project on going.

 
Profile Image
Eifert@Aximmetry
  -  

Hi Jim,

We don't have a time estimate on this request.

Warmest regards,

 
Profile Image
coffeezilla
  -  

I'm facing the same issue. I'm trying to get some footage into blender w/ FBX and am struggling to match camera distortion. With all the relevant information being within the .xdata format it seems like there should be some documentation on either 

a. how to parse xdata

b. how to create a widely used lens distortion model like STMAP. 

Without this, it's a giant PITA to get a good render that matches CG/REAL. Will put notifications on for this thread in the hopes they support this soon. 

 
Profile Image
jim4586
  -  

@Eifert was there any update on this?

 
Profile Image
Eifert@Aximmetry
  -  

Hi Coffeezilla and Jim

Are you using fixed zoom? Or does your zoom level change during production?

There is no way to parse xdata other than using Aximmetry Composer to parse it in playback.
There is no ready-made solution to make STMAPs, but we are actively considering adding such a feature.

Warmest regards,

 
Profile Image
jim4586
  -  

Hi Eifert, Mostly primes.

Can you provide a document with the data binary layout used for Xdata? We would like to put together some external helper scripts to better work with Xdata recordings. That would greatly help.

 
Profile Image
Eifert@Aximmetry
  -  

Hi Jim,

We don't have such a document.
If you can tell us what would be the use case of it, then it will probably be released/implemented sooner.

Until that, you could actually use Aximmetry to playback the Xdata and save it in a different format using for example the Text Exporter module. Or record the tracking like that in the first place.

Warmest regards,

 
Profile Image
jim4586
  -  

Well there is many use cases, but one key thing is right now the xdata gets recorded in a single, long file during a session under a certain fixed filename. However, when we record in camera each clip has a different name and we start/stop record very frequently.

Now with the xdata format, we could for example write a little script that takes a directory with subdirectories that contain all the clips, we can look up the start and end timestamp of each clip, and then automatically write a new xdata file that only has the relevant data and also has the correct filename to match the clip. So that when we load the clip, the right tracking data shows up without having to replicate a huge xdata file over and over by hand for each file. (without introducing extra conversion steps or extra work in between)

Another example would be for example to directly import xdata in other software, or for example to write a quick USD converter. So that Aximmetry can work better in a VFX pipeline.

You could also benefit from others writing additional tools, making you a stronger platform. Kind of like how it's possible with other software like Maya or Nuke. For example the data files for Maya can be saved fully as ASCII to better integrate with pipelines to quickly go through shots that need completion. There is also USD as a format to help facilitate exchange better as an open standard.

 
Profile Image
Eifert@Aximmetry
  -  

Hi Jim,

Thank you for the reply.
Indeed, all that would be helped if xdata was readable.

Warmest regards,

 
Profile Image
Eifert@Aximmetry
  -  

Hi,

We're excited to share that our latest release, Aximmetry Version 2023.3.1, which has just been launched, now includes an STMap generator.

To access this feature, locate the STMap compound at [Common]:Compounds\Utilities\STMap_Generator.xcomp.
Here are a couple of ways you can set it up:

  • For live tracking input - simply use a Camera Tracking module:


  • For playback of tracking recording from tracked camera compounds - Use the Record Data collection pin's Lens Distortion key to get the Lens Data:

Thank you for your patience and ongoing support.

Warmest regards,