New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide Sample Showcasing Ability To Load Complete Model Information #80
Comments
Hi, fbx2skin was renamed sample_fbx2mesh some time ago, while documentation wasn't updated. It's done now, thanks! fbx2mesh is a command line tool which serializes mesh data as If your objective is to read meshes imported from fbx with sample_fbx2mesh, then you'll need to deserialize/load them like samples are doing. Vertex and tesselation information are then directly accessible from I think you understood that, but as a reminder this pipeline was done for samples needs only, it's not a library feature. You might want to start form there though and extend it to your needs. Hope it helps, |
I've been going over and over the provided sample framework and also studying fbx2mesh. I'm getting confused because a few of the samples are rendering a mesh and when you look inside the media folder for these samples there is a 'mesh.ozz' file. I'm just trying to wrap my head around how this is being executed in the framework. This is an amazing library, the documentation does a decent job of explaining how things work, and the provided sample code is extensive in showcasing features. Unfortunately for me when I look at the sample code there is so much going on I can't quite wrap my head around it. If there is a way to extract vertex/index/etc.. data using ozz then I want to take that route. If I need to load the original .fbx file in to get this information then I will do it that way. I just want to make sure i'm approaching the problem properly and taking the correct approach. I have skeleton and animation data loaded with animations playing without a problem, it's time to apply them to a physical model and I can't visualize a clear starting point to accomplish this. |
Hi!
I'm confused as to what you're trying to accomplish? The sample_fbx2mesh
will load an fbx file and serialize (like the mesh.ozz file you're
referring to). This is a representation of a mesh which you can load using
LoadMeshes()
<https://github.com/guillaumeblanc/ozz-animation/blob/3e86c6f27fb5714e24738da5de7b6d3776099b93/samples/framework/utils.cc#L401>
and then use to initialize buffers for your favorite graphics library. Are
you struggling to construct vertex and index buffers for rendering with
that data? Or are you looking to fully parse and process the fbx files
yourself into your own datastructures?
As far as the complexity of the sample converter. There is unfortunately no
"simple" way to demonstrate traversing and building meshes from fbx files
(or any other reasonably useful scene format for that matter). There's a
minimum amount of code necessary to grab everything you need and turn out
something useful. My suggestion would be to run fbx2mesh in a debugger and
follow through to get an idea of the structure. You'll find that it's
mostly boilerplate for reading data from the fbx file.
The basic idea is
- Load the fbx file in
- Iterate all the nodes in the scene
- If the node is a mesh, extract mesh data (this is where it gets
really messy)
- If the node is a bone, add it to a skeleton
- Once you're done processing the mesh and the skeleton, you can build
an inverse bindpose for skinning the mesh
- Serialize the mesh and bindpose so you can load it in your game.
There are many flavours but they all taste similar to this
Good luck,
/ Kyle
…On Fri, Nov 8, 2019 at 2:33 PM Kyle Klouzal ***@***.***> wrote:
I've been going over and over the provided sample framework and also
studying fbx2mesh. I'm getting confused because a few of the samples are
rendering a mesh and when you look inside the media folder for these
samples there is a 'mesh.ozz' file. I'm just trying to wrap my head around
how this is being executed in the framework.
This is an amazing library, the documentation does a decent job of
explaining how things work, and the provided sample code is extensive in
showcasing features. Unfortunately for me when I look at the sample code
there is so much going on I can't quite wrap my head around it.
If there is a way to extract vertex/index/etc.. data using ozz then I want
to take that route. If I need to load the original .fbx file in to get this
information then I will do it that way. I just want to make sure i'm
approaching the problem properly and taking the correct approach.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#80?email_source=notifications&email_token=ABFY7V27QZEX4F7Z6KS3HP3QSW5J5A5CNFSM4JF4DC72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDTEGPY#issuecomment-551961407>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABFY7V3GS5XNVSAISAJ2DGDQSW5J5ANCNFSM4JF4DC7Q>
.
|
Sorry for the late reply. Here is where my confusion was: I had assumed that an .ozz file created with fbx2ozz contained vertex data about the model which I could in-turn extract and use to render the model itself. It does not. As the documents state this is an animation library and does not directly facilitate the rendering of 3d models. That's fine, my ignorance into what this library did and did not do lead me in the wrong direction. I have since directly used the AutoDesk FBX SDK to retrieve per-vertex data including vertex position, bone id's and bone weights. I have also successfully rendered my models like this. Now I am stuck getting bone transformation matricies out of OZZ and into a glm::mat4[] for upload to my skinning shader.
Can anyone shed light on how to elaborate on this section:
|
While the fbx2ozz tool doesn't. The fbx2mesh sample does exactly what your talking about.
Your Edit:
|
@kylawl Thank you for your help, I really appreciate it.
Sadly I cannot go straight from an As far as fbx2mesh goes, I have looked through and studied the code behind it and I just couldn't wrap my head around everything that was going on. I think it will be more advantageous of me to do it as I am now and use the FBX SDK directly to acquire what I need from my .fbx files while letting ozz handle the animation portion. I may look into this again in the future but for now I can get what I need using the FBX SDK. Thank you again. EDIT: This gets some output back on the screen, so I think i'm going in the right direction at least. It's basically garbage output though.
|
So this looks like your example here should work. However, I have no idea what the return value of |
The horizontal rotation is likely just an up-axis issue. Your renderer is are zup and your model is Y. Not sure what the deal with your mesh is. Maybe something to do with importing a mesh with mirrored UVs? Maybe miss calculating prim counts?
Ya the soa joints count will always be rounded to the nearest 4 joints. This is part of the simd optimized evaluation in the jobs. Your best bet now is to debug draw some lines for the skeleton so you can see how the skeleton is or isn't aligned with your mesh. Good luck |
Thank you again for all your help, I wouldn't be this far without it! I'm sure it's because I need to I've raised an issue on stackoverflow, as complicated as it might be, hopefully someone will give a bit of insight here. https://stackoverflow.com/questions/59032693/convert-ozzmathfloat4x4-and-fbxsdkfbxdouble4-to-glmmat4-for-gpu-sk |
http://guillaumeblanc.github.io/ozz-animation/documentation/geometry_runtime/
The following is stated:
"Note that ozz does not propose any production ready tool to load meshes or any mesh format. See fbx2skin from ozz sample framework for an example of how to import a skinned mesh from fbx."
None of the current samples or documentation explain how to retrieve vertex, index, uv, etc.. data from models. It is to my understanding after reading the provided documentation and studying the provided samples that you are required to load this information into an application using other means?
https://github.com/guillaumeblanc/ozz-animation/blob/master/samples/framework/tools/fbx2mesh.cc
Appears to showcase how to retrieve this information but the file is over 1000 lines and after going through it a few times leaves me wishing for a proper sample explaining the process.
Could it be possible to provide a sample explaining how to retrieve this data from our loaded models?
The text was updated successfully, but these errors were encountered: