Export Node, Mesh, Materials and Textures to load them later over c++ api


photo

Recommended Posts

Hi,

is there a fast way to export a Node reference with all its subobjects (objects,meshes,materials,textures) into a single folder.

Our Artist imported a fbx file in Unigine Editor and I want only the converted assets, to load it later with the c++ api on the fly at any given location in the filesystem dynamically.

I know, that they are saved in the .runtime folder, but it is hard to search for every object/mesh/material/texture manually with a few hundred subobjects uglyfied.

Thanks,

Sebastian

Edited by sebastian.vesenmayer
Link to post

Hello Sebastian,

There's no straightforward way to do this, but we can help you with the custom code that will parse node reference.

I need to clarify two things before we start:

  1. Do you want to extract runtimes only? No assets required?
  2. How you're planning to use this extracted node with related files? As far as I understood you want to put it in the external folder (not in the data directory of your project) and then load on demand.

Am I correct?

Thanks.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post

Hi morbid,

1. I am not sure if I get this correctly, but the meshes/materials/textures are located in the .runtime folder when importing a fbx and place it as a node, am I right? Do I only need these files for the Node/NodeReference? Then I would say yes.

2. The files will be placed together anywhere on the hard drive and I am loading the nodes on demand.

Thanks.

Link to post

1. Yep, that's right. I'd like to remind you that runtime files will be unavailable in the editor.

2. Got it, thanks.

We're discussing possible solutions and I have some new questions:

  1. Can you show us a sample of such node reference? What objects you're storing inside?
  2. Which SDK version is this?
  3. The general task is to export node to another project, am I right? If you want to add the same node in the project it was extracted from, GUIDs will conflict and you won't be able to load this content.
  4. May I ask you how urgent is this for you?

Thanks.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post

1. I can send you a node file later when, with all the object references.

2. atm we are on 2.7.2.but are looking forward to upgrade soon.

3. Not really a project, we are using Unigine as a rendering component and start always with an empty world with only rendersettings configured. Most of the content we are generating ( loading unigine nodes/ setting custom shaders / converting our own asset files) will be delivered over c++ api to the engine. We are not using a guids table because content changes with each customer and String/path based is more readable and configurable to us.

4. We are planning to integrate Unigine Editor in the workflow for our artists to polish our graphics, because we did not use pbr rendering in our old graphics engine. We are also planning to create our own 3D editor with unigine to address our needs. I have to discuss this first with our team. Arround August I guess.

 

Thanks

Link to post

If your node has only meshes and materials you can use the following pipeline to get runtimes with paths:

  1. Parse the node and find all GUIDs
  2. Find all runtime files with getAbsolutePath method https://developer.unigine.com/en/docs/2.7.2/api/library/filesystem/class.filesystem?rlang=cpp#getAbsolutePath_cstr_String
  3. Here come some specific things. Meshes are the easiest to process. You can find the required files with getAbsolutePath, no extra actions required.
  4. Materials and Properties files can be found in 3 steps.
  5. Texture path can be found in the material file with getTexturePath method: https://developer.unigine.com/en/docs/2.8/api/library/rendering/class.material?rlang=cpp#getTexturePath_int_cstr

Hope this helps. Let us know if you need further help on this task.

Thanks!

UPD
I've accidentally wrote getTextureName instead of getTexturePath. Now I've changed the text and the link.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post
  • 4 weeks later...

Hi,

is it possible to reference the texture and meshes with a relative and not absolute path?

Else we have to regex replace materials and nodes when the root folder structure changes.

Thanks!

Link to post

So something like:

<texture name="emission"> ../textures/example.dds </texture> 

is not allowed?

Link to post

Thanks, I know what you want to say, so everything is only relative to the data path, but never from subfolders.

Is this going to happen in future versions, that I can reference from a sub folder?

Edited by sebastian.vesenmayer
Link to post

We're focused on our new file system based on unique IDs (guids). Paths are considered to be a legacy in the current SDK versions.

So, I'm afraid we're not going to extend or modify paths support in the future.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post