cnr-isti-vclab / nexus

Nexus is a c++/javascript library for creation and visualization of a batched multiresolution mesh
GNU General Public License v3.0
216 stars 89 forks source link

any way to convert back from .nxs? #6

Closed Fxlr8 closed 7 years ago

Fxlr8 commented 7 years ago

Hi, i wonder is there a way to convert model back from .nxs to any mesh format like obj or stl?

ponchio commented 7 years ago

Sure, nxsedit can be used to convert back to ply using the -p option.

You can also extract a simpified version ( -l removes one level, basically halving the number of triangles), -s will extract a ply approximately that big, or -t specifies the number of faces in the output.

Basically you can use Nexus as an out-of-core simplification.

You might want to remove duplicated vertices in meshlab on the output.

roobscoob commented 5 years ago

Hi! I did this, but the ply file did not include the texture, is there any way to include the texture?

ponchio commented 5 years ago

I don't think that's actually possible: the texture coordinates were not present in the original model... I'm not sure I understood what are you trying to do.

roobscoob commented 5 years ago

when I view the model with nsxview it displays the texture on the model, I would like to export the model and the texture for viewing and editing in other applications.

ponchio commented 5 years ago

The texture is butchered beyond reconstruction by the nxsbuilder processing, and makes it not really usable in any editing software. I didn't bother to export it.

roobscoob commented 5 years ago

Is there any possibility of recovering it anyways?

ponchio commented 5 years ago

Yes, if you can render it you can export it. I need a good reason to spend my time doing that, though.

roobscoob commented 5 years ago

I'm wrapping nsxedit in Node, if you can give me an idea of how the texture is stored in the file i may be able to write the code to extract the texture myself.

ponchio commented 5 years ago

In nexus.js the functions requestNodeTexture and loadNodeTexture load the textures from the nxs. Basically the array mesh.textures contains the offset of the texture (stored as a jpeg) for each node. For node n, the beginning and end of the jpeg image in nxs are stored in mesh.textures[n] and mesh.textures[n+1], to load the in the browser the data returned from a partial httprequest is loaded as source of an image: img.src = urlCreator.createObjectURL(blob) and the url revoke once loaded the img. urlCreator.revokeObjectURL(img.src); but I image in node.js the procedure would be different.

On Mon, Oct 14, 2019 at 12:54 PM RowanHall notifications@github.com wrote:

I'm wrapping nsxedit in Node, if you can give me an idea of how the texture is stored in the file i may be able to write the code to extract the texture myself.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/cnr-isti-vclab/nexus/issues/6?email_source=notifications&email_token=AAUDV27IMDE3DUYJYD4XWXTQORFX5A5CNFSM4DMGSY32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBEE52Q#issuecomment-541609706, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUDV2YSKPLFIQ5QBIHHUFLQORFX5ANCNFSM4DMGSY3Q .