cnr-isti-vclab / nexus Goto Github PK
View Code? Open in Web Editor NEWNexus is a c++/javascript library for creation and visualization of a batched multiresolution mesh
License: GNU General Public License v3.0
Nexus is a c++/javascript library for creation and visualization of a batched multiresolution mesh
License: GNU General Public License v3.0
Hi.
I have tried to use color buffer attribute in my ply file as vertex id and pass a binary file with colors as a typed array.
My problem is that it seems that the color I have set in my ply file are not properly preserved.
In order to set the color in my ply file I use this function:
function numberToRGB(rgb){
var r = Math.floor(rgb / 65536);
var gb = rgb - ( r * 65536);
var g = Math.floor(gb / 256);
var b = gb - ( g * 256 );
return [ r, g , b ];
}
Then when I generate the scene to be exported to ply I set the color attribute for each buffergeometry in this way:
```
var colorArray = geo.attributes.color.array;
var geoLen = geo.attributes.color.count;
//var internalColor = new THREE.Color("#" + decimalToHex(i));
var internalColor = numberToRGB(i)
for ( var j=0; j<geoLen; j++ ) {
colorArray[j3] = internalColor[0]/255;
colorArray[(j3) + 1] = internalColor[1]/255;
colorArray[(j*3) + 2] = internalColor[2]/255;
}
The problem is that when I try to retrieve this color from the nxz file to use it as the id the id many times is wrong.
Is there any decimation on the color attribute that could give this lack of precission?
Best regards
Unable to process landscape models like the one attached. Opens fine in blender and mesh lap.
Version 4.1.6 (same issue in 4.1.5)
It creates the cache_stream file then crashes. I'm having the same issue on a few files.
trim_castle.zip
The textures were in a different file, so fixed, please delete this issue.
Assertion failed: (n>0 && max_size[0]>0 && max_size[1]>0), function PackInt, file /Users/long/Documents/work/myprojects/NodeJS/nexus/nexus-master/../vcglib/vcg/space/rect_packer.h, line 259.
I want to convert a very big(1GB) .obj model to .nxs but failed. I tried to use more memory but not work.
nxsbuild c.obj failed
nxsbuild -r 8000 c.obj failed too
Mac 10.14 16GB memory
What are the limitations for manipulating the geometry once loaded in THREEjs?
Particularly I want to be able to displace the vertex positions, with a different displacement per vertex. The issues I am facing are as follows.
Thank you
When trying to convert a relatively large OBJ file (364mb) nxsbuild is hanging.
Womp-iMac:Desktop hunterfortuin$ nxsbuild cargo_bottle33.obj -r 5000
Reading cargo_bottle33.obj
Vertices read: 1360086
Colors read: 1
faces read: 2723700
Components: mesh colors
Normals enabled
Colors enabled
Creating level 0
Creating level 1
Creating level 2
Creating level 3
It got through the the first three levels in about an hour but it's been stuck for an additional hour on the fourth level.
Here is the file: cargo_bottle33.obj
Attempted on both an OSX 10.13.6 machine and an Ubuntu 18.04 machine.
I am trying to use nxsbuild.exe to process a 354mb binary .ply generated by AGISoft PhotoScan, with 4 .jpg textures that are each 4096x4096. I get this:
C:\Users\aaron\Downloads\Nexus_4.1.5>nxsbuild.exe C:\Users\aaron\sfm\streambed\streambed.ply
Reading "C:\\Users\\aaron\\sfm\\streambed\\streambed.ply"
Mesh with colors
Mesh with textures
Normals enabled.
Colors enabled.
Textures enabled.
Creating level 0
Fatal error: Unespected missing image in disk and ram.
I wonder what the problem is. The ply opens fine in CloudCompare and Meshlab, and I am not out of ram -- in fact I have 30gb free when it crashes.
FYI - You need to add stlloader.h and stlloader.cpp to the HEADERS and SOURCES in the CMakeLists.txt in nxsbuild.
I'm porting a game from its native client to a web version. The biggest hurdle is latency in streaming the world map to the client (it's quite large so I don't want to download the map to the client).
If I can convert the world map to a Nexus-compatible object, can I stream only the portion of the object that I want to render within the client?
Hi! For a PLY file I tried to convert to .nxs files, I receive the following message in the console:
nxsbuild 200k_meshlab.ply -r 14000
Reading 200k_meshlab.ply
Components: mesh colors textures
Normals enabled
Colors enabled
Textures enabled
Creating level 0
Creating level 1
Creating level 2
Creating level 3
Unable to properly simplify due to framented parametrization
Using a smaller node size (-f, default is 32000) might alleviate the problem
The PLY mesh (10MB) contains 200K faces / 95K vertices. There are 40 JPEG textures (in total 67.8MB).
As a consequence, I tried to rerun the command using the -f
option and different values (30000-25000-20000-10000-5000-1000). All of these processes manage to finish, but the resulting .nxs/.nxz is unacceptably distorted when I view it in nxsview
nxsbuild 200k_meshlab.ply -f 20000 -r 14000
Reading 200k_meshlab.ply
Components: mesh colors textures
Normals enabled
Colors enabled
Textures enabled
Creating level 0
Creating level 1
Creating level 2
Creating level 3
Stream: 29076 Last top level size: 34136
Quitting prematurely (most probably to high parametrization fragmentation)
Unifying normals
Saving to file 200k_meshlab.nxs
Any idea on how to proceed with this mesh? Are there any settings of nxsbuild/nxsedit I can change, or can I do some preprocessing of the mesh elsewhere?
Wanted to add a bit of feedback for installing on Clion for ubuntu,
Within CMakeLists.txt I had to add glew to the include_directories ine:
include_directories(../../../vcglib ../../../vcglib/eigenlib ../../../glew-2.1.0/include )
In settings>Build,Execution,Deployment>CMake I added to CMake options:
-DCMAKE_PREFIX_PATH=/home/parallels/Qt/5.11.1/gcc_64/lib/cmake
also I had to install corto:
download from GIT: https://github.com/cnr-isti-vclab/corto#libcorto
cmake ./
make
sudo make install
sudo ld config
Then the project complied successfully. Hope this saves a bit of time in the future.
Hi,
Interesting work! I was wondering if it's wise to implement this into Unity? I'm looking at a solution to stream sensitive encrypted CAD model data over a local network. I see how it handles the simplification.
Hi there,
I have only just started trying Nexus and for geometry it seems to be working really well. However, I am trying to convert files with high resolution textures and the final .nxs files, whilst textured, do not seem to have a very good resolution for the texture itself. I have tried various settings, for number of faces per patch and texture quality, but it doesn't seem to make much difference to the output.
I was wondering if you could describe a general workflow for models with high resolution textures in order that I can understand this better. The example models on your website seem to have fairly good texturing compared to what I am getting.
I would also like to understand what the limit is likely to be when texturing, to understand what kind of loss of quality I might expect to get when converting files.
Many thanks.
I've been testing a few models through processing compressing and displaying. The nxs and nxz files generated work through nsxview and appear in the HOP webviewer, but I can't get them to appear in the THREE.js webviewer.
Has something changed to the format in the last build?
The gargo.nsz test file works but newly generated ones don't.
I should add, I'm not getting any errors back from the browser. The only way I know there is an issue is by looking at scene.children[3].instance. All the values here are 0.
UPDATE: I have it working now, not sure what's changed, but the files are loading nicely.
The OBJ reader (objloader.cpp) uses case sensitive string comparison functions, for example str.startsWith("Map_Kd")
. Since the OBJ format is not case sensitive, or at least, different software seem to write the files differently, it would be preferable to support all OBJ files, regardless of the case used (especially in the .MTL file)
I'm trying to run the example in html directory, which uses three.js. I'm serving it using WebStorm's built-in server and viewing it with Chrome 59.0.3063.4 dev (64-bit) on Windows 10 15063.14 . In the browser I just get a black screen and can't even open the Chrome dev tools. Any ideas? Is there a working example of nexus with three.js online somewhere I can compare with?
Building using the instructions in INSTALL.MD, it seems nxscompress does not get compiled.
I use THREE.OBJLoader2 loadMtl function load material and send the material to NexusObject constructor as the last parameter but only the model mesh shows up, no material visible.
Material is ok and right loaded I'm very sure about that.
If I load the model from .obj file format and set the same material every is all right.
can anybody give some examples of wireframe mode and point cloud mode showing .nxs model ?
any advice is wellcome!
Hi.
I am trying to use gl.readPixels functionality in order to retrive information from GPU side. Basically I want to retrieve the position and vertex id using this function. I am cuerrently using THREEJS abstraction function called readRenderTargetPixels
function pick(){
var fb = gl.createFramebuffer();
console.log(canvas_h, canvas_w, mouse);
pickingRenderTarget = new THREE.WebGLRenderTarget( canvas_w, canvas_h, { autoClear: true, minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat, type: THREE.FloatType } );
var read = new Float32Array( 4 );
renderer.render( scene, camera, pickingRenderTarget );
console.log(pickingRenderTarget.height);
renderer.readRenderTargetPixels( pickingRenderTarget, 10, 10, 1, 1, read );
console.log(read);
var v = new THREE.Vector4(read[ 0 ], read[ 1 ], read[ 2 ], read[3]);
retrun v;
}
My problem is that when I try to use this function, which I have used in standard bufferGeomtries in THREEJS, I get this error:
threejs.js:25333 THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.
I am starting to think that this issue is linked with the internal WEBGL behabiour of Nexus.
Is there any way to achieve this?
When I load a NXZ point cloud in three.js, and I change the points material size, I don't see anything changing. I use the following:
nexus_obj.material = new THREE.PointsMaterial( { size:500, transparent: false, opacity:0.25 , vertexColors: THREE.VertexColors } );
Am I missing something here? Thanks!
We are using Nexus and 3DHop to develop a web app, with very good results, it's a really good software. However, we have found that sometimes nxsbuild fails when given a textured PLY file. It seems that some software add unnecesary whitespace around the texture file name, and Nexus doesn't trim that whitespace, so it tries to find a file that doesn't exist.
We have found a solution: just replace line 120 of file src/nxsbuild/plyloader.cpp from this
texture_filenames.push_back(buf2);
to this
texture_filenames.push_back(QString(buf2).trimmed());
Hello,
Thank you for sharing this library and tools, great work!
Would it be possible to use an original model geometry at the highest LOD?
Assuming the initial loaded nxs and /or nxz model does not have color. How can I update the color attribute to apply a color value for each vertex after the model is loaded in THREE js?
Hi, i wonder is there a way to convert model back from .nxs to any mesh format like obj or stl?
I'm trying to run nsxview.exe on Windows 59.0.3063.4 dev (64-bit), uncompressed from http://vcg.isti.cnr.it/nexus/download/Nexus_4.1.4.zip but I get lots of errors about missing .dlls:
Qt5Widgetsd.dll
Qt5OpenGLd.dll
Qt5Guid.dll
Qt5Cored.dll
I tried renaming Qt5Widgets.dll which comes in the .zip to Qt5Widgetsd.dll and the same for the other four, but then it complained about other .dlls.
Is there a prerequisite that I have to install, like qt dev tools or something?
when i use nxsbuild.exe convert a obj file to nxs, itβs ok.
but when i use nxsview show nxs file,it lost textures.
i use meshlab open the obj file ,it can see textures.
how can i convert it with textures?
Hi there! Would I be wrong to assume that nexus limits the size of the internal textures to 4096? I took a peak at the code, and that's the value I see in the texpyramid.h. (And generally that's the size of texture that modern mobile devices support.) If that's not the case, is there a way to specify this limit?
There is always a segmentation error when converting a .nxs file consisting of only point cloud to a .ply file. Did I use it improperly? Thanks.
I'm under macOS Mojave 10.14 and I compiled the newest nexus from source code 2018-10-8. I got nxsbuild nxscompress command line and I converted .obj file to .nxs and .nxz. the .nxs shows up fine but the .nxz file not showing up.
I just replaced the model file name of your html example from gargo.nxz to my .nxz file but nothing shows up.
I can load gargo.nxz in my test program.
I can load both your .nxz and my .nxz file into nxsview app.
Hi, I am trying to render a nxz model using three.js with double sided material and polygon offset. changing the material doesnt seem to have any effect on the rendered output.
I am using your product (nexus) and I noticed a lot of shimmer while rendering on the client. I dug into the code and figured out that the textures nexus creates are not power of 2. I changed it so that textures are always power of 2 and I was able to turn on mipmaps on the client. So, my question is: what was the reasoning behind this choice? The only downside to forcing textures to be a power of 2 is that they are slightly larger, but with JPG compression, that should be negligible. Would you mind sharing why you guys made this choice and is there something I am missing?
If there are no reasons why we can't force pow of 2, ill make a patch.
Thanks!
Are there still windows builds of Nexus distributed anywhere?
I use THREE.Raycaster for mouse picking, but this does not work with nexus because the geometry is not stored the way that three expects.
It would be great if nexus had its own raycaster, or else it was modifed so that three.js raycaster works.
I converted a model from obj to nxs than I compressed. When I open this model with NXSViewer, I have no problem. My problem is when I load the model through threejs. The model load just fine but I can't fit my camera to the model because I'm having huge bounding boxes computed. For example, I have a model that has a bounding box of max size 30 (opened and calculated via MeshLab), the same model loaded in threejs has a bounding box of max size 4000. So, my function to fit the camera to the object is working but it's not fitting well since the boundingbox is 15 times larger than the model.
I can't public this model but if anyone can help me, I'm able to send the model privately.
Sorry about my English. It's not my main language.
I would like to read in a vertex id value int vertId
for each vertex and export that value for each vertex in the final nxs and nxs files. I attempted this by following a similar procedure for adding vertex color values.
However I'm finding that this involves many code additions across many files in nexus. Is there an easier way to do this? More generally is there a good way to add generic data members to the vertices and faces that will be tracked and exported in the final nxs and nxz files?
I tried everything to dispose the mesh but my RAM goes down 1mb at maximum. I know that when I don't add the mesh to the scene, the page takes up 4mb of RAM. When the mesh is loaded, the same page takes up 25mb of RAM. I'm running this function to dispose things but it seems it's not working.
`
function remove(){
scene.traverse(function(o){
if (o.geometry) {
o.geometry.dispose();
}
if (o.material) {
if (o.material.length) {
for (let i = 0; i < o.material.length; ++i) {
o.material[i].dispose();
}
}
else {
o.material.dispose();
}
}
});
renderer && renderer.renderLists.dispose();
renderer && renderer.dispose();
stopAnimate();
renderer.domElement.parentElement.removeChild(renderer.domElement)
window.removeEventListener('resize', onWindowResize, false);
window.removeEventListener('keydown', resetCamera, false);
scene = null;
camera = null;
renderer = null;
nexus_obj = model = null;
pCamera = oCamera = null;
controls = null;
}
`
Any help?
Testing converting sample obj
and stl
files to nxs
with nxsbuild
.
While loading into Threejs
, the lower resolution levels show geometry artifacts in the form of long spikes coming off of the model. see attached snapshot.
The spike artifacts are resolved as higher resolution levels are loaded and rendered.
Any ideas what could be causing this? My initial idea is overflow of vertex coordinate calculation.
When I load my own converted PLY mesh into .nxz in the three.js app you've shared (https://github.com/cnr-isti-vclab/nexus/tree/master/html), I notice that about 90% of the texture is not acceptable. When I view the same .nxz in nxsviewer, everything looks good. See attached image:
Greetings.
I am trying to use Your JS library to render nexus files in a browser.
I have tried using the three.js version of Your library, and I find myself quite satisfied for its semplicity.
However, I could not render a nexus file that was loaded without using the new NexusObject()
method.
More specifically, I have some resources that reside in an un-accessible (from a webserver point of view) folder, and the access to (and elaboration of the files in) this folder is regulated by my application.
I can send the nexus data to the client via HTTP or WebSocket, but then I cannot seem to be able to use this data in the NexusObject.
By looking though the code, it seems that the loading of the data is done only via a range request.
Is there any other mean to use the data that has already been downloaded?
Or will there be any possible evolution of the library to enable this use case?
Thank you for your attention.
When the NexusObject is created I want to center the model to (0,0,0) position so I called nexus_obj.geometry.center() function and it's not work as I expected. If I use threejs default obj loader and center the geometry after the obj is loaded every thing is ok
three.js will soon add a system for dynamically loading data into meshes: mrdoob/three.js#13196
If nexus_three.js loaded data into the three.js gl buffer instead of doing its own thing, then we could take advantage of more three.js stuff. For example, we could use the raycaster that three.js meshes use and that would also solve #9.
Do you plan including CMake building scripts? I can help with that if needed.
Hello. I'm trying to stream a "large" dataset (not very large in reality, only 80 Mb after NXZ compression). I took sample the code of this page, just changing the file path.
--> After few seconds, my server crashes with a 429 error... Is there an explaniation/solution ?
The help for nxsbuild says that you can use the -z option to output a compressed nxz file instead of an nxs, but it appears to have no effect. I see there is also source for something called nxszip -- is that how we're supposed to make .nxz?
Hi.
I have built a very simple geometry (BufferGeometry) with attribute color inside giving for each vertex a random color. I saved the geometry inside a obj file but when I converted it to nxz format I realized that vertex colors are not kept. I see everything in black (0,0,0).
Is vertex color attribute supported by nexus?
I have tried with nxsBuild -C for keeping colors but the same result.
Many thanks in advanced.
I'm just wondering if the nsxedit has a built-in way to convert from a .nxz file to a .ply or .stl, etc.
Thanks!
The same key name decodeDiff
is defined twice in MeshCoder
for meco.js
Hi! Thanks for the nice library and three.js support! I played a little bit with different sample files before moving to my own files, and I found that there seems to be an issue with viewing the church_pointcloud.nxz
. I'm using Chrome and I received the error ERR_CACHE_OPERATION_NOT_SUPPORTED
. It does load in an Incognito Chrome browser and Firefox. It might be something similar as the issue mentioned in webtorrent/webtorrent#1193 (comment)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.