Comments (7)
As far as I know, there is no software that can assign feature IDs to vertices directly. (I have heard rumors that Blender can assign ~"per-vertex attributes", but this would not be exported to glTF by default). You have to know which vertex should receive which ID, and assign this information to the vertices when you are creating the glTF.
I'm also not aware of any open-source software or library that can (officially) generate glTFs that have this extension. I recently added support for this extension in 3d-tiles-tools
, and an example for assigning feature IDs to vertices is shown in the ExtMeshFeaturesDemo.ts
. But this is not part of any official API, and it may be changed arbitrarily or even removed at any time. Maybe there will be broader support for this extension in the future.
from gltf-tutorials.
@javagl thank you for you reply,i pull the 3d-tiles-tools and run the ExtMeshFeaturesDemo.ts but it throw a error
in method savePixelsInternal
const data = putPixelData(pixels, new Uint8Array(width * height * channels));
the data is empty
from gltf-tutorials.
From a quick glance, this error seems to come from the ndarray
library. What happens when you run this test:
import { savePixels } from "ndarray-pixels";
import NdArray from "ndarray";
async function runTest() {
const sizeX = 3;
const sizeY = 3;
const pixels = NdArray(new Uint8Array(sizeX * sizeY), [sizeX, sizeY]);
for (let x = 0; x < pixels.shape[0]; x++) {
for (let y = 0; y < pixels.shape[1]; y++) {
pixels.set(x, y, x * sizeY + y);
}
}
console.log("pixels ", pixels);
const image = await savePixels(pixels, "image/png");
console.log("image ", image);
}
runTest();
from gltf-tutorials.
@javagl it shows that
from gltf-tutorials.
i think the problem occur in ndarray-pixels-node.cjs putPixelData()
from gltf-tutorials.
There seems to be a difference between a JavaScript and a TypeScript context. I haven't understood all the details here yet, but opened donmccurdy/ndarray-pixels#156
As a quick fix, you could change the code that fills the pixels, to anticipate that there are 4
channels (and the values are written into channel 3
):
// Create an image with integer values that serve as feature IDs
const sizeX = 3;
const sizeY = 3;
const pixels = NdArray(new Uint8Array(sizeX * sizeY * 4), [sizeX, sizeY, 4]);
for (let x = 0; x < pixels.shape[0]; x++) {
for (let y = 0; y < pixels.shape[1]; y++) {
pixels.set(x, y, 3, x * sizeY + y);
}
}
(I haven't tested it thoroughly, but it should solve the issue for now).
But note that the example only generates "some dummy data", only for testing the implementation of the extension. I have also opened CesiumGS/3d-tiles-tools#62 to track the process to create an extended/updated/fixed demo.
from gltf-tutorials.
I assume that this can be closed for now.
But a small aside: Somone wrote a nice summary of how to add metadata information to models in Blender at https://community.cesium.com/t/gltf2-0-in-ue5-2-metadata-ext-structural-metadata-ext-mesh-features/26873/8 . There may be some manual steps involved, but it will certainly provide a good starting point.
from gltf-tutorials.
Related Issues (20)
- how to calculate the global inverse transform HOT 4
- implementing an algorithm for the simpleSkin model from this github HOT 7
- Update and simplify the skinning section HOT 6
- glTF/GLB model size - is there any tool for checking it? HOT 2
- Update links to point to the Khronos glTF registry
- Question about keyframe compression HOT 2
- Clarify component order for quaternions in scene/node page HOT 5
- Cannot replicate Skin glTF-Tutorial data contents HOT 2
- gltfTutorial_020_Skins.md typo HOT 3
- Minor readability issue - image 18b HOT 3
- Please rename default branch from 'master' to 'main' per Khronos policy HOT 10
- Hi, what is the right thing to do if JOINT_0 comes in a model in the format short 5123? HOT 2
- can Mesh be used in several different Skins? should I provide for this when loading glb? HOT 2
- Where should joint matrices be stored? HOT 2
- Some phones don't draw models if indicesComponentType=5125-GL_UNSIGNED_INT. But they draw fine if indicesComponentType=5123-GL_UNSIGNED_SHORT. I think it may be related to the support on the phone OpenGLES3+. Or are there other reasons? HOT 3
- Animation in model without skeleton and bones HOT 2
- does gltf support metadata, KV string map for example HOT 2
- Hi, is there an example for OpenGL ES 3 using a normal map in glsl shaders to render gltf models? Could you point out a good link to explore? HOT 2
- is it possible to somehow determine in which units of measurement the model is located? Millimeters, centimeters, meters or inches? HOT 1
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 gltf-tutorials.