Jump to content

Wrong output from ObjectMeshSkinned.addMeshSurface(*) function


photo

Recommended Posts

Hi,

 

i have problem with function ObjectMeskSkinned.addMeshSurface(*), when i do duplicate surfaces in model UMA_male.rar, i get this result post-716-0-66814300-1442585728_thumb.png.

 

Code:

void test_addMeshSurface() {
	ObjectMeshSkinned fullMesh = new ObjectMeshSkinned("UMA_male.mesh");
	fullMesh.setMaterial("mesh_base", "*");
	engine.editor.addNode(node_remove(fullMesh));

	ObjectMeshSkinned reduceMesh = new ObjectMeshSkinned("UMA_male.mesh", 1);
	engine.editor.addNode(node_remove(reduceMesh));

	for(int i = 0; i < fullMesh.getNumSurfaces(); i++) {
		string surfaceName = fullMesh.getSurfaceName(i);
		reduceMesh.addMeshSurface(surfaceName+"R", fullMesh, i);
	}
	reduceMesh.setMaterial("mesh_base", "*");
}

Thanks

Honya

Link to comment
  • 9 months later...

Hi,

 

i have another example of wrong output when use function addMeshSurface.

On the picture you can see from left UMA_female.mesh, multiple5.mesh and result.mesh.

post-716-0-41639600-1468061953_thumb.png

 

Result mesh was created this way: added multiple5.mesh to UMA_female.mesh.

Test scene merg.rar, it created in 2.3-beta, but i have same result also in 2.2.1-2.

 

Thanks

Honya

Link to comment

Hi Honya,

 

Thank you for the test scene. I've successfully reproduced this issue.

 

Also, if I will add multiple5.mesh as static mesh (not skinned) into the scene it will be rotated 90 along X axis (similar result that you have as a result after addMeshSurface.

 

We will try to find out what happens here.

 

Thanks!

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

Link to comment

Hi silent,

 

thanks for the hint.

 

I found why it is this way even it look right in 3ds max.

In the source .fbx file that mesh have set rotation X: 90, so it lying, bud thanks to the rotate it placed right...

 

So to fix it i must load imported mesh in resource editor and 3rd times save it with check "Flip Y/Z axes and inverted Y axis" then the surface is added in right position, but when i add as skinned mesh, then its lying.

 

So i found workaround to get right mesh for add surface, that is important for me, but it's not perfect.

Link to comment
  • 1 month later...

Hi,

 

when i try create new surface and in same time add to it another surface, it create wrong surface model.

On the post-716-0-82477400-1471174318_thumb.png you can see the result of it on left, on the right is wanted surface model.

 

Also when uncomment line 35, then the scene crash.

 

Here is a simple project unigine_project.rar.

 

Unigine version is 2.3.

 

Thanks

Honya

Link to comment

Hi Silent,

 

i create new project, where i change API to Unigine script only and Precision to float, on other PC with Browser 1.7.3 (5778) with Unigine 2 professional 2.3, download rar and unrar it to the created project and it not crash.

 

I also add log file from other PC where it working.

The line with "memory corruption detected" appears after close application.

 

So i suggest to comment all my line and then uncomment one for each try to run it to find why it crashing.

 

Honya

log.html

Link to comment

Honya,

 

Please, check working test scene in the attachment. Unfortunately, what you are trying to achieve (merge multiple surfaces into single surface) is not possible, because you can't change dynamically number of vertexes that already stored in the surface.

 

We will try to fix behavior when you need to manually call body.setFrame(0,0) method to update mesh surfaces.

 

Maybe you will give us more detailed information about what you want to achieve in general (not in terms of code)? If there any other possible solution we will surely let you know.

 

Thanks!

unigine_project.cpp

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

Link to comment

Silent,

 

i start use code that i wrote 2 years back in Unigine 1, where this feature worked fine.

 

Purpose is simple, to boost fps count.

When i compare scene with 440 characters that have lot of surfaces with same 440 characters that have merged same surfaces to the one, then i get fps boost around 50%, that's a lot.

 

So i want create single surface from lot surfaces that are added to source model, when i create also atlas texture, so in the end i have only one surface with one textures instead of lot of surfaces with lot of textures.

Link to comment

2Silent:

 

We were using this merge functionality for already 2(?) years, it stopped working with latest updates. We are using it for equipable character. It is critical performance optimization, when we merge surfaces of various pieces of equipment into one. Not needed for one character, critical for dozens.

Link to comment

Silent,

 

i check versions 2.1, 2.2 and both have same issue.

 

In 2.0 cannot check, because i get bad index error, but i check this function on this version and it work, i assume on base this https://developer.unigine.com/forum/topic/2944-solved-infinite-loop-when-i-try-create-atlas-image-with-less-than-8-image/?hl=%2Batlas#entry15823 forum topic, because i use ImageAtlas class when i merge surfaces to one.

Link to comment

honya

 

This method was working as expected back in 2014?

 

We added blend shapes support and changed mesh file format in Unigine 2.0 Alpha (2014-10-09). It seems that the last working version for that code was 2014-07-07 SDK, am I right? Since that the mesh format was changed and I can't really test this behavior with your current sample.

 

The root cause of that issue might be added morph targets support to mesh format. This addition can introduce certain restrictions to the mesh surfaces handling logic, I'm afraid.

 

If you have some old meshes (back from 2014-07-07 SDK) and working test sample we would like to test it with old SDK as well.

 

Sorry for the inconvenience caused.

 

 

 

 

 

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

Link to comment
  • 1 month later...
  • 2 weeks later...

Hi Jirka,

 

Currently there is no changes for this ticket. I will try to raise the priority of this task, but there is a little chance that we will fix it in 2.4 SDK, sorry. More likely fix will be available in 2.4.1, sorry.

 

Ok, thanks for update.

Link to comment
×
×
  • Create New...