horde3d / Horde3D

Horde3D is a small 3D rendering and animation engine. It is written in an effort to create an engine being as lightweight and conceptually clean as possible.
http://horde3d.org/
1.55k stars 308 forks source link

colladaConv process joints #103

Closed shadowver closed 7 years ago

shadowver commented 7 years ago

This is more like a question than an issue. I tried to convert some animated character models(dae format) to geo format that H3D can process. I encountered a warning message saying my character has more than 75 joints. Once the model is loaded into the engine, the joint's index (in abc.scene.xml file) which higher than 75 are missing and so does the meshes. Is there a restriction with H3D that prevent loading models that have more than 75 joints?

Great work on the new version thou. Thanks a ton.

algts commented 7 years ago

Hello. Thanks for finding this. This restriction was made in horde's early days, when video cards could not handle more than 75 joints. Currently OpenGL 4 renderer backend should support at least 256 joints per mesh (up to 330). OpenGL 2 backend stays at 75. But, you are right, this converter message has to be remade. Will patch it soon. Edit: are you modifying a sample, like Chicago or Knight? If so, please change H3DRenderDevice::OpenGL2 to OpenGL4 in class constructor in app.cpp and see, whether this behaviour persists.

shadowver commented 7 years ago

Hi aglts,

Thanks for the reply. Chicago and Knight are working perfect. I was actually trying to render my own 3D models that contains more than 75 joints, hence encountered such issue. I actually looked into the converter source code and it seems the problem has been fix with latest version(even the message said so). I will try again with OpenGL4. Again, thanks for the great work.

Edit: I have changed OpenGL2 to GL4 and modified the WindowHint Major from 4 to 3 as I am using GL version 3.3. I could not even load the model this time as previously the model could load but missing those joints whose indexs that higher than 75. I will keep exploring what might went wrong.

algts commented 7 years ago

Can you upload your model somewhere for testing? Or, if you can't, do you know any free rigged 3d model with more than 75 bones?

algts commented 7 years ago

Are you using an (old) intel or a low level video card? Found a model with more than 200 bones and it displays correctly under Win10 with intel hd 530 and nvidia 960 in the editor... Perhaps, it has something to do with GL_MAX_VERTEX_UNIFORM_VECTORS parameter (how many vec4 can be passed to vertex shader at once) - if it is 256 then it would be the answer why nothing shows up on the screen in gl4 backend. Currently, gl4 backend uses 990 vec4 (330 mat4*3) for joints, because most of the video cards can handle 1024 vec4 at once and many also feature 4096 vec4 per vertex shader...

shadowver commented 7 years ago

thanks for the reply. I can send you the link where I download the model if you like. The machine I used is i7 with Nvidia 940M. I did not use editor to load the model thou instead of I use ubuntu and opengl ditectly. Yesterday I used my model loading module, based on assimp lib, to load the same model under dae format and it worked. let me try again with different model and get back to you. Thanks.

algts commented 7 years ago

You can check your device opengl capabilities via this tool: http://opengl.gpuinfo.org/download.php (requires installed libglfw3 and glew). If GL_MAX_VERTEX_UNIFORM_VECTORS is lower than 1024 then model would not display under GL4 backend. You can try to lower "uniform vec4 skinMatRows[330*3];" parameter until you see results on screen (located in Content/shaders/utilityLib/vertSkinningGL4.glsl). You should probably start with 200 or something like that.

shadowver commented 7 years ago

Thanks algts, for the suggestions. Let me try and get back to you.

Edit: I just tried what you have suggested. This time, I got an error message "unable to initialize resource". However, I do solve my previous model loading problem with the older version of the engine by changing the skinMatRows[753] to [903]. However, the same approach wont work under the latest release. I will dig deeper furthermore and share any findings.

zuck commented 7 years ago

Fix in develop branch.