Jump to content

Creating ObjectMeshStatic without mesh


photo

Recommended Posts

Posted

I want to create a ObjectMeshStatic using a node file but do not want to package the Big .mesh file with our application. 

I am planning to download the .mesh file from some server (.node file can be in "data" dir) and update the "mesh_name" once download is complete. Is there any way I can achieve this?

I can do this by creating a ObjectMeshStatic and then assigning the materials separately But I do not want to change our assets pipeline (which till now saves the .node and .mesh and just loads it at the application startup)

I prefer not to modify the node file and still be able to change the mesh at runtime. 

<?xml version="1.0" encoding="utf-8"?>
<nodes version="2.5.0.2">
	<node type="ObjectMeshStatic" id="1648265773" name="test_file">
      		<mesh_name>test.mesh</mesh_name>
		<surface name="concrete" material="ab637a5aa75d6e05021a0657f5c75f85c6dbaeea" property="surface_base"/>
		<surface name="conveyor belt" material="4a54cad7ccd49ee7ba4b7f98136af3cd7be3ce40" property="surface_base"/>
		<surface name="mesh grating" material="9c7ec23bd8d66b5fc8b07e7efe842f88b4c1db03" property="surface_base"/>
		<transform>0.001 0 0 0.0 0 0.001 0 0.0 0 0 0.001 0.0 0 0 0 1.0</transform>
	</node>
</nodes>

 

I tried removing the mesh file but that shows the warning for missing material when I loadNode() and when I called setMeshName("path",1) it did not applied the materials back (Which was kind of expected). I also tried playing with Cast, MeshPtr etc but no luck.

Note: We are creating .mesh and node file from .fbx and Using Unigine 2.6.1

Posted

Hi Pryank,

Have you tried to call console command filesystem_reload once you finished mesh download? Engine filesystem need to know that some files were added after engine already started.

Thanks!

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

Posted (edited)

I tried that but that didn't help. This is what I am doing at the moment

  • m_mesh = Unigine::ObjectMeshStatic::cast(Unigine::World::get()->loadNode(<resource_dir_path>.node));
  • m_mesh->setMeshName(<cache_directory_path>.mesh, 1);
  • call console command filesystem_reload

I didn't expected that to work as well, since our resource_dir_path and cache_directory_path are not same? (Our resource_dir_path is present in ulink file)

Edit: If I download the mesh file at <resource_dir_path> and call filesystem_reload then loading node works. But I want to keep mesh in separate directory because all the resources are packed in ung file.

Edited by Priyank.Jain2
Posted

Hi there, Priyank!

First of all, let's clarify stuff related to data paths and possible ulink removal. In new system you'll be able to use mount points in order to add link to external content. Each mount can have its own virtual path related to your project's data folder while having different physical location. For example, you can download heavy content to some kind of cache folder and then you could add a mount point somewhere inside your data folder (as it's still in development I can't tell how exactly it'll look like but probably pretty similar to .ulink file). After that you can access the content via virtual path. Think of this a .ulink files on steroids.

Regarding your problem, I recommend to create a simple dummy meshes with no geometry but with the same surface structure as big mesh have. Then use ObjectMeshStatic::setMeshName once you've downloaded new mesh. If new surface count & names will match with old ones then materials / properties / visibility bindings will be applied to new mesh.

Posted

Thanks for the clarification uncleBob

Yes that's an option to have dummy mesh. I just want to minimize the work on the mesh import/creation side hence the resistance.

×
×
  • Create New...