Jump to content

Migration from 2.7.1 to 2.7.2.1 problems


photo

Recommended Posts

Hi everyone,

I try to migrate to the newest version of unigine now, but ran into problems that weren't there in the previous version.

While I try to initialize the first material 4 assertions will be triggered in the engine.

	auto materials = Unigine::Materials::get();
	auto material_name = Unigine::String("Fixes_Material");
	auto material_library_name = material_name + Unigine::String(".mat");
	auto fixesMaterial = materials->findMaterial(material_name.get());

	if (!fixesMaterial){
		auto meshBase = materials->findMaterial("decal_base");
		assert(meshBase && "decal_base material not found");

		fixesMaterial = meshBase->inherit(material_name, material_library_name);
		int id = fixesMaterial->findParameter("albedo_color");
		fixesMaterial->setParameter(id, Unigine::Math::vec4(red, green, blue, 1.f)); //<-- this call triggers the assertion
		fixesMaterial->setDepthTest(0);
	}

image.png.2ed280629af4ac803030b50c51b1d743.png

image.png.b323202313dabd039a3df690e0b4945c.png

It worked in version 2.7.1 without problems.

 

Also I noticed many Warnings in the output log and it seems like I can't load  and save mat files and tga files I load/create anymore, this results in that most of the decals not visible anymore:

<uniginerenderimpl.cpp (940)>: FileSystem::addVirtualFile(): can't find mount point for "Runways.spec.shading.tga" file

FileSystem::addVirtualFile(): can't find mount point for "Runways.spec.shading.tga" file
<uniginerenderimpl.cpp (940)>: FileSystem::addVirtualFile(): can't find mount point for "C:/Temp/TableTop/database_Decals_Runway_mat_decal.mat" file

FileSystem::addVirtualFile(): can't find mount point for "C:/Temp/TableTop/database_Decals_Runway_mat_decal.mat" file
<uniginerenderimpl.cpp (940)>: Xml::save(): can't create "" file

Xml::save(): can't create "" file
<uniginerenderimpl.cpp (940)>: Material::save(): can't save "" file

Material::save(): can't save "" file
<uniginerenderimpl.cpp (940)>: FileSystem::addVirtualFile(): can't find mount point for "TaxiwaysApronsLight.spec.shading.tga" file

FileSystem::addVirtualFile(): can't find mount point for "TaxiwaysApronsLight.spec.shading.tga" file
<uniginerenderimpl.cpp (940)>: FileSystem::addVirtualFile(): can't find mount point for "C:/Temp/TableTop/database_Decals_LightApron_mat_decal.mat" file

FileSystem::addVirtualFile(): can't find mount point for "C:/Temp/TableTop/database_Decals_LightApron_mat_decal.mat" file
<uniginerenderimpl.cpp (940)>: Xml::save(): can't create "" file

Xml::save(): can't create "" file
<uniginerenderimpl.cpp (940)>: Material::save(): can't save "" file

Material::save(): can't save "" file

Thanks in advance for your help, I will provide more information if needed.

 

Regards,

Sebastian

Link to comment

Just found out that the assertions are triggered because there is no parameter "albedo_color" for decal_base. It is "albedo". "albedo_color" exists in mesh_bash. I didn't check if the id is -1.

The second problem is still there. This causes that most of the decal meshes are not shown anymore.

Link to comment

Hi silent,

 

I added a mounting point to save files now to the file system. Now I am able to save the materials again to the absolute path I give. Same for the converted tga files which are Blob files.

Saving meshes is working without a mounting point. Will this change in the next release too?

Maybe it should be documented that it is not possible to save materials and Images outside paths which are not mounted.

 

I still have a problem with the decals which did not exist in the 2.7.1 release.

Not all decals will appear when our Application runs.

When I am saving the nodes/materials/textures and open them in the Unigine Editor all decals will appear.

It is kind of random behavior which decals do appear and which do not in our Application.

All decals, meshes (50 MB) and textures (4 GB ) will be translated and loaded on startup before the first frame have been drawed.

 

Did you made any big internal changes to the decal drawing mechanism between 2.7.1 and 2.7.2?

 

Thanks,

Sebastian

 

Link to comment

Sebastian,

Quote

I added a mounting point to save files now to the file system. Now I am able to save the materials again to the absolute path I give. Same for the converted tga files which are Blob files.

 Saving meshes is working without a mounting point. Will this change in the next release too?

 Maybe it should be documented that it is not possible to save materials and Images outside paths which are not mounted.

We will update our docs for sure. Could you please share us some code that you are using for that operation which triggers the different behavior?

Quote

Not all decals will appear when our Application runs.

When I am saving the nodes/materials/textures and open them in the Unigine Editor all decals will appear.

 It is kind of random behavior which decals do appear and which do not in our Application.

The only big change (except the filesystem) is the texture streaming. To find a real issue we need to check a related test scene (I believe that we can also sign NDA for any sensitive data). After that we would be able to provide a fix or some workaround. Could you please prepare some test scene for us and upload it to file hosting? That would help a lot.

Thanks!

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

Link to comment

Hi silent,

Quote

We will update our docs for sure. Could you please share us some code that you are using for that operation which triggers the different behavior?

Sure.

Quote

Could you please prepare some test scene for us and upload it to file hosting?

I can but may take some time.

Thanks.

Link to comment
int AppWorldLogic::init()
{
	// Write here code to be called on world initialization: initialize resources for your world scene during the world start.
	const char * path = "C:\\Test\\App";

	//This line is necessary since Unigine 2.7.2.1, else materials cannot be written into file system on windows and blob file cannot be generated for image
	//Note: path "C:\\Test\\App" must exist and user needs permission on parent directory "C:\\Test" to write the .umount file.
	//auto m_fsTemp = Unigine::FileSystem::get()->createMount(path, path, Unigine::FileSystemMount::ACCESS_READWRITE);


	Unigine::ImagePtr imagePtr = Unigine::Image::create();
	imagePtr->create2D(128, 128, Unigine::Image::FORMAT_RGBA8);
	for (int i = 0; i < 128; ++i){
		for (int j = 0; j < 128; ++j){
			imagePtr->set2D(i, j, Unigine::Image::Pixel(0, 255, 0, 255));
		}
	}
	const char * imagePath = "C:\\Test\\App\\test.dds";
	Unigine::FileSystem::get()->addBlobFile(imagePath);
	auto savePath = Unigine::String(imagePath);
	imagePtr->save(savePath.get());									//Output
																	//FileSystem::addVirtualFile() : can't find mount point for "C:/Test/App/test.dds" file

	auto materials = Unigine::Materials::get();
	auto meshBase = materials->findMaterial("mesh_base");
	auto unigineMaterial = meshBase->inherit("myTestMaterial", "myTestMaterial.mat");
	unigineMaterial->save("C:\\Test\\App\\myTestMaterial.mat");		//Output:
																	//FileSystem::addVirtualFile(): can't find mount point for "C:/Test/App/myTestMaterial.mat" file
																	//Xml::save() : can't create "" file
																	//Material::save() : can't save "" file

	return 1;
}

This is the minimal example for the material/image save issue.

Link to comment

Sebastian,

BlobFile and Materials are working on GUIDs, that's why you can't save them to unknown location. There is no such limitation for meshes yet. So, your code is looks pretty much as it should be.

Btw, correct mount usage from API should look more like this:

String mount_abs_path = "D:/test/app";
String mount_path = "test_mp/";

if(!FileSystem::get()->getMount(mount_path))
	FileSystem::get()->createMount(mount_abs_path, mount_path, FileSystemMount::ACCESS_READWRITE);

String savePath = mount_path + "test.dds";
Unigine::FileSystem::get()->addBlobFile(savePath);
imagePtr->save(savePath);

<...>

Virtual path (second argument) should be relative to the main mount path.

Thanks!

  • Like 1

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

Link to comment

Hi silent,

I tried your mount usage with the relative path but it creates a folder in the data path, which I don't want to have, our use case needs paths absolute and not relative to Unigine Engine specific files, and new folders should mostly not be created.

I did workaround the decal issue and created standard ObjectMeshStatic with a little offset on each other. This is not perfect but we have no time to investigate it furthernow.

Reproducable samples will be delivered much later and we have to discuss what models we can give to you because of our NDA with one customer.

Thanks,

Sebastian

Link to comment

Sebastian,

So, If I understand your use case correctly you have:

  • App folder:
    • bin
      • your_app.exe
    • data
      • core.ung
      • .runtimes (???)
  • Remote folder with all data that mounts in runtime

and that's basically all files you want to provide to end-user? All the data is located outside of the App folder (let's say on network drive). And in some cases you want to create files in that remote folders? 

Quote

Reproducable samples will be delivered much later and we have to discuss what models we can give to you because of our NDA with one customer.

There is no need to have the exact models if you can reproduce it with basic primitives as well. It would be even better :)

Thanks!

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

Link to comment

Hi silent,

at the moment we have this structure for our project, because most of our applications work like that.

App:

  • folder
    • executables
      • my_app.exe
      • Unigine.dll
    • dbase
      • profiles
        • my_app
          • data
            • core.ung
            • my_app.world
            • my_app.cfg

Asset  files with our internal format are located anywhere the customer places it (UNC path/local)

We convert the meshes, textures, materials on the fly and save most of them into a tempory location on the hard drive, because of 32 bit limitations of internal libs at the moment, the plan was to create only blob files in future use cases. I don't know if this problem exists anymore, but we saved the converted data because of loading problems when we had the workshop with unclebob.

%USERPROFILE%\AppData\Local\Temp\my_app

The folder structure of the App should not change.

Quote

There is no need to have the exact models if you can reproduce it with basic primitives as well. It would be even better :)

I will try to make examples when I have more time for that ;)

Thanks

Edited by sebastian.vesenmayer
Link to comment
×
×
  • Create New...