-
Notifications
You must be signed in to change notification settings - Fork 966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
draco_encoder problem #67
Comments
Are you referring to sub-objects in the .obj file? If so, then yes, the current version of draco_encoder does convert them into a single mesh. Sub object ids are still stored in a GENERIC attribute though, but to separate the mesh into the sub-objects you would have to write your own logic on the client app. If that's what you want to do I can give you some pointers. We will add support for preserving sub-object for .OBJ files in future (when we add support for metadata). |
@ondys ,yes,I want to refer to sub-objects in the .obj file. |
@ondys my Email address is 815237345@qq.com |
I'll just write it here so other people can find it too. Each sub-object of the input OBJ is assigned a id that is equivalent to it's location in the .OBJ file (so the first sub-object has id == 0, second 1, third 2, etc...). No sub-object names are currently preserved. The sub-object ids are stored for every face of the mesh and to get them on the client, you need to get a generic attribute with custom_id() === 1 :
You can then get the sub-object id values as:
This array will store a sub-object id for every point of the mesh, but all points that belong to the same face are always going to be mapped to the same sub-object id value. You can then use these ids to split the mesh into different geometries. |
@ondys |
@kappa-gooner The generic attribute is not going to be created if there is only one sub-object in the obj file. If that's not your case, can you please post a link to an .OBJ that shows the problem? |
@ondys Please scratch that request. |
@kappa-gooner Depends what sub-mesh info you are looking for. We store material ids in another generic attribute (with custom id 0). The file that you originally linked was also using |
@ondys |
@ondys I was able to pull out the
|
|
@ondys :
Any pointers that could help me out? :-/ |
@ondys : I figured out the problem.
So, point 0 ends up being subObjectId 250 which is counter-intuitive at first; but rather makes sense now. And a big thank you for helping me over the last 2 days. |
I'm glad it worked for you but I would just like to warn you that there may be some potential issues with your solution. First, your proposed loader assumes that all positions and all indices are always stored consecutively in the loaded buffers .. e.g. this code:
That is true only if the sub-objects are separate mesh components. If the sub-objects were defined on a single mesh component (faces connected together but belonging to different sub-objects), then this is not going to hold anymore. The same is true for the To solve this, you would have to do something like this:
Overall, it shouldn't be more code than what you already have, but you will need the extra map between the global and local point indices |
@ondys: Do consider exposing an interface that provides the sub-object data in a more straight forward fashion that does not require such data manipulation at load time. 🥇 |
@kappa-gooner Can you share your code? I would think that it should be relatively fast. Note that you need only one global-to-local point map that is common for all sub-objects (from your post it sounds like you may be using multiple maps). What I'm thinking that we could do in future is to add more direct support for sub-meshes into Draco.. for example we could split the input mesh into multiple sub-meshes based on some per-face attribute (sub-object id, material id, or whatever) and then encode these sub-meshes separately. It may hurt compression somehow, but it would definitely make it much easier to handle these cases on client apps. |
@ondys I found that most obj files I with use g and s for polygon/smoothing groups. Meanwhile,can DracoLoader return bufferGeometry which will contain all groups that the obj file owns not just one mesh? |
@Frankling I'm not sure if I understand the question. Draco currently does not parse polygon/smoothing groups so they are all contained within the same bufferGeometry. Do you want to have a separate geometry returned for each group? |
@ondys |
@ondys there seems to be no attribute.custom_id() function in latest version 1.0.0. There is a unique_id() function but the condition (attribute.attribute_type() === dracoDecoder.GENERIC && attribute.unique_id() === 1) is not true for any attribute. Is there some changes in version 1.0.0? |
@shubhamagarwal003 That's correct. With the newly introduced support for metadata, we have decided to remove custom_id as it was redundant. If you parse .obj file with multiple generic attributes (sub objects + material ids) then I you can turn on metadata by passing In javascript you can get the attribute id for a given metadata entry using this method:
Note that if you do the encoding directly using C++ api, you can still set the |
I'm closing this issue. If you are still having problems please re-open. |
Any update on making a direct support for JS encoder or DracoLoader to get sub-object information. Actually if you can add polygon groups (g) or smoothing groups(s) support in a more straight API it would be very helpful |
Any updates on adding support to preserve sub-objects? |
Hi,is this encoder compress all mesh in one (e.g. one obj has same meshs), then decoder it just one mesh?
The text was updated successfully, but these errors were encountered: