Comments (4)
The global transform is explained in this section. The pseudocode for the computation of the global transform could be
Matrix computeGlobalTransformOf(Node node) {
if (!hasParent(node)) return node.transform;
else return computeGlobalTransformOf(node.parent) * node.transform;
}
(Note: The "parent" is not stored directly in the JSON. This pseudocode should just illustrate the idea about how it is computed in theory).
The inverse of that transform is ... just the inverse of this matrix :-) Depending on the programming language/environment that you are using, you'll almost certainly have some sort of Matrix
class that already offers some invert
function.
(Here is one implementation of such a function (in Java, but so low-level that it only needs arrays, and thus, could trivially be ported to any other language), but usually, you do not have to write this sort of code on your own - every 3D vector/matrix library already offers that).
from gltf-tutorials.
cool, thank you.
if my node doesn't contain any scale vector, rotation vector or translation vector. the default value for rotation are all 0? the default value for scale are all 1? and the default value for translation are all 0?
my last question is: how to convert this vector [ 0.259, 0.0, 0.0, 0.966 ]
to the matrix rotation given in this tutorial https://github.com/KhronosGroup/glTF-Tutorials/blob/master/gltfTutorial/gltfTutorial_004_ScenesNodes.md#global-transforms-of-nodes
from gltf-tutorials.
Yes,
- the default rotation is 0
- the default scale is 1
- the default translation is 0
meaning that the resulting matrix will be an identity matrix in this case.
how to convert this vector
[ 0.259, 0.0, 0.0, 0.966 ]
to the matrix rotation
The value for the rotation is (in some sense not a "vector", but) a quaternion that describes the rotation. Again, most libraries for 3D vector math should already have some function to convert a quaternion into a 4x4 rotation matrix. (In doubt, another very low-level implementation is shown here , but one should preferably use an existing function for this if it is available...)
from gltf-tutorials.
thanks for these precious info
from gltf-tutorials.
Related Issues (20)
- 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
- how to use schema.json in gltf2.0 HOT 7
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.