Comments (2)
Hi @gmiguelr87,
as you probably know Nexus is a multi-resolution format. It splits original geometries in tree structures composed by nodes. These nodes (all together) compose a representation of the original model (at different resolutions). 3DHOP uses this format just because the progressive loading of the various nodes doesn't impact too much on the performances of common browsers. Unfortunately for you, this also means that you will never have your model geometry loaded in memory all together (unless your file is very small). In fact, the system interactively loads just the nodes needed, choosing them depending on several parameters (point of view, GPU load, network conditions, etc).
So, you cannot access "all the vertices of the model" in your 3D scene (unless profound changes to the source code that would distort the basis of the 3DHOP framework). Instead, what you can do, is to access the vertices of the nodes requested and loaded from the beginning of the rendering by the 3DHOP.
To do this, take a look at the "readyNode" function in the "nexus.js" file (line 1152). As you can see, in this method, starting from the nodes buffers containing all the model information (vertices positions, colors, normals, etc.), we build indices and vertices typed arrays to be sent to the shaders. So, adding your own source code in this point you can access all the vertex information belonging to the nodes that 3DHOP is loading on the virtual scene.
Some examples...
...if your Nexus model is compressed with corto:
- adding
console.log("POS: "+v[0]+" "+v[1]+" "+v[2]);
after line 1194, you can read on your browser console the x,y,z position coordinates of the first vertex of the node loaded; - adding
console.log("NOR: "+Math.max(no[0]/32767, -1.0)+" "+Math.max(no[1]/32767, -1.0)+" "+Math.max(no[2]/32767, -1.0));
after line 1208, you can read on your browser console the x,y,z normal vector coordinates (normalized) of the first vertex of the node loaded;
...if your Nexus model is not compressed (or it is compressed with meco):
- adding
var ver = new DataView(node.buffer, 0, nv*12); console.log("POS: "+ver.getFloat32(0,true)+" "+ver.getFloat32(4,true)+" "+ver.getFloat32(8,true));
after line 1162, you can read on your browser console the x,y,z position coordinates of the first vertex of the node loaded; - adding
var nor = new DataView(node.buffer, off, nv*6); console.log("NOR: "+Math.max(nor.getInt16(0,true)/32767, -1.0)+" "+Math.max(nor.getInt16(2,true)/32767, -1.0)+" "+Math.max(nor.getInt16(4,true)/32767, -1.0)); console.log("COL: "+co[0]+" "+co[1]+" "+co[2]+" "+co[3]);
after line 1178, you can read on your browser console the x,y,z normal vector coordinates (normalized) and the rgb values of the first vertex of the node loaded (of a model with both vertex color and normal vectors);
However, also with these modifications, you could retrieve just partial information about the 3D model visualized (since new nodes are continuously loaded, and old ones are continuously discarded), so I'm not sure they can help you on your purpose.
Ps: the line numbers above mentioned refer to the current 3DHOP DEVELOPMENT version ("4.2.8").
from 3dhop.
Dear @potenziani ,
Thank you very much for your detailed response. One of the things I love 3DHop for is progressive loading, so I won't distort the basis of the framework.
The purpose was to be able to export the 3D model in other formats from 3DHop, and it is obvious that it is not possible without modifying the basis.
However, you have provided me with very valuable information, because I can think of interesting things to do with that information (partial model information), such as generating simplified pointclouds or estimation of volumes.
Thanks again!!
from 3dhop.
Related Issues (20)
- Touch control HOT 2
- Modifying Touch Sensitivity HOT 3
- Deformed model when changing trackball position [trackballs paradigm] HOT 3
- Resizing after full screen view in Firefox not working properly HOT 5
- keyboard input disabled HOT 2
- adding loading masks to the canvas HOT 2
- bump/normal etc HOT 1
- loading many nxs files [dynamic scene declaration] HOT 13
- Objects have limited rotation angle in certain axes (usually Y and Z) [trackballs setup] HOT 2
- Implementing 3DHOP in Rails HOT 5
- Implementing 3DHOP in Drupal HOT 3
- Setting tabindex on canvas messes with focus in Firefox HOT 2
- jQuery no-conflict mode + docker + implementing 3DHOP in Clowder HOT 51
- Allow configurable selectors HOT 1
- Data/LODs stop loading in (after using viewer for a few minutes) [nexus setup] HOT 3
- [Feature requests] Screenshot resolution multiplier; rotate plane section tool HOT 3
- Textured objects are not displayed on iOS HOT 1
- Trackballs dragging speed option HOT 3
- Input data for "animateToTrackballPosition"
- Best Tools for Rendering Very Large Meshes with Millions of Vertices/Faces in Browser
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 3dhop.