Jump to content

shadow generator serialization issue


satguru
 Share

Recommended Posts

serialization uses mesh id to add mesh to the shadowgenerator renderlist
if two or more mesh have same id then during deserialization only one mesh gets added to the renderlist
and thus only one of them displays shadow

Instead of meshid maybe we should use  the mesh's uniqueId ?

Today, as a workaround, just before I serialize a scene,  I rename all mesh id and give each of them unique id 

 

Link to comment
Share on other sites

The mesh's uniqueId is generated real-time and is not being serialized. So we won't be able to use it during serialization.

I guess the main problem here is that only the first object with the same ID is being added to the list and not all. So instead of getMeshWithId, with should use getAllMeshesWithId (not real code, just an example).

Would that be a solution to your problem?

Link to comment
Share on other sites

getAllMeshesWithId will work for me because I need shadows for all my meshes.

 

It may not not work for somebody else  though.

So lets say you have three meshes A,B,C all with same mesh id.

and further A and B needs shadow but C does not .

If we use getAllMeshesWithId    then C will end up with shadows too.

 

My current workaround of making each mesh id unique just before serialization,  is satisfactory for me.

I do not use the mesh id for anything specific.

May not work for others though

 

Currently we had a mesh name, mesh id and a mesh unique id.

Maybe mesh unique id should be some kind of GUID. This way it does not have to be re-generated every time and can then be safely used as a serialization id.

 

Similar issue with skeleton id ad mesh.

During serialization we associate a skeleton with a mesh using the skeleton's id.

If the skeleton id is not unique then during deserialization the wrong skeleton could end up getting associated with a mesh.

In my case  I make each skeleton id unique just before serialization.

 

Another thing to keep in mind, as we think about this issue, is that unlike mesh, skeletons do not have a unique id.

 

Link to comment
Share on other sites

You are fully in charge of providing your meshes with IDs. So, as you say, you can keep them unique yourself.

UniqueID is a very simple auto-incrementing integer located in the scene. Adding it to the skeleton (or any other object generated by the scene, which is almost all) will not be a problem, if needed. but again, this is an id provided during run-time. The developer can (and should) take care of providing unique ids to the objects.

I have just commited a new function to the scene, getMeshesByID(id: string) that returns an array of meshes if they have the same ID. the shadow manager now uses this function, so the problem should be eliminated now.

Link to comment
Share on other sites

Thanks.

This will take care of my problem but may be not of others.

 

I am not very comfortable with the system using an id which it does not control, for serialization which it does completely.

Maybe a protected property called serializationID / serialID added just for serialization deserialization might be the solution.

 

Till then few lines in documentation clarifying the role of ids might be helpful. 

Might put in a PR for documentation. 

Wish we had 48 hours a day here, like what you, obviously, have in Berlin :)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...