glscene / GLScene

GLScene is a graphics engine based on OpenGL with VCL components for Delphi & C++ Builder.
http://www.glscene.org
Mozilla Public License 2.0
216 stars 32 forks source link

SMD Actors not loading (it seems since V2.x)... #21

Closed macropoloxxi closed 2 years ago

macropoloxxi commented 2 years ago

I have recently moved to V2.2 and some previous projects I had with *.smd objects are not loaded now. It doesn't generate any specific exception but none of them (I tested at least 5 models) is loaded.

It can easily be reproduced with the mesehs/SlkeletaD demo. The actor "Trinity" that used to be shown here is now a single point. The same happens with all others I have tested...

Many thanks for any help.

glscene commented 2 years ago

No, it's not reproduced, the actor is shown correctly, check your current version in repository

glscene commented 2 years ago

Trinity

macropoloxxi commented 2 years ago

Thank you for the answer.

It is quite strange because I'm trying my 11.2 Delphi with GLScene V2.2, GlScene V2.1 (SourceForge last version) and I allways get this:

image

I have reinstalled all the packages, recompiled the sources, installed the externals... nothing changed. The exe in a different computer with all the info still fails (you can test it in this .zip if you want):

skeletal.zip

I still have another PC with RAD 10.3 and GLScane V1.8 and it works perfectly.

Many thanks in advance.

glscene commented 2 years ago

Hm, no, all runs right, check your computer. and you don't need to include .dcu, .local etc. files in a zip archive to test your code. Pavel

macropoloxxi commented 2 years ago

Hm, no, all runs right, check your computer. and you don't need to include .dcu, .local etc. files in a zip archive to test your code. Pavel

Than you for your new test. It drove me to think what could be happening. It is a Regional Settings problem (not existing in V1.x). My natural regional settings are spanish (so decimal point separator being ,) and this happens:

GLSCeneES

So I changed it to English and effectively now it works:

GLSCeneEN

You see the difference changing from Español (Argentina) to English (United States). As the .smd are text representation of decimal values, it seems that since V2.X all are interpreted using the regional setting, but it should not be like that because the .smd ALWAYS are . separated and don't depend on the regional decimal separator:

skeleton time 0 0 0.233849 0.368164 39.526119 0.000000 0.000000 -1.570795 1 0.000000 0.000000 0.000000 -1.570795 -1.570451 0.000000 2 -0.000005 0.000007 3.713254 0.002054 3.115505 -0.021473 3 18.045725 0.000000 0.000000 0.000000 0.000000 -0.121501 4 17.597599 0.000000 0.000000 -0.002613 0.026036 0.099967 5 3.793089 6.407221 0.000000 0.000000 0.000000 1.570796

I think it should not be difficult to address...

Many thanks for your help.

macropoloxxi commented 2 years ago

I have already a version of Files.SMD that using a local TFormatSettings and now with all StrToFloatDef with the third parameter does the trick:

//By PAL, added to fix problem with decimal separator in non En configurations var fs: TFormatSettings;

//By PAL, added to solve problem loading files when non En regional settings set fs.DecimalSeparator := '.';

i.e. frame.Position.Add(StrToFloatDef(tl[1],0,fs), StrToFloatDef(tl[2],0,fs), StrToFloatDef(tl[3],0,fs));

Here is my modified source (tested in regional settings non-US now it works OK):

GLS.FileSMD.zip

Regards, Pablo

glscene commented 2 years ago

Hi Pablo, you found good decision for .smd import and I updated gls rep. We need to use .gltf/glb model files instead of .smd or .md2 also. I've prepared units that must be included in https://github.com/GLScene/GLScene/blob/master/Source/GLS.FileGLTF.pas. So if you have interest to make the import you could help in the work. Thank you. Pavel

macropoloxxi commented 2 years ago

Thank you Pavel! I'm going to take a look at it.

I'm currently doing some stuff with .smd models with .smd animations exported from Blender software. That's because I couldn't find a better way of managing animations of complex models in GLScene.

Is there any way to manipulate in runtime "rigged" models directly in GLScene?

Bones or at least point of meshes can be transfomred at least?

What other format would be better for it than the .smd fot this operations? Clearly text .smd files are huge and unefficient.

Many thanks in advance. Regads, Pablo.

glscene commented 2 years ago

Yes, yet .smd format is good in glscene, but now the gltf/glb format is more advanced for animated models as in MS Paint 3D. see a conversion for pascal in https://github.com/BeRo1985/pasgltf and especially for Vulcan https://github.com/BeRo1985/pasvulkan. It's necessary to have import/export unit for gltf/glb in GLScene. By the way, Blender should have import/export for the format also. Sincerely, Pavel

macropoloxxi commented 2 years ago

Hi Pavel!

I have sarted to try the GLTF import. Generating the GLTFs from Blender objects (native export to GLTF 2.0) I'm unable to import none of the examples I had into GLScene.

Of course I have added the GLS.FileGLTF and GLS.FileGLB in the uses clause, but I keep receiving the classical message:

image

I'm using the last code you pointed in: https://github.com/GLScene/GLScene/blob/master/Source/GLS.FileGLTF.pas

If you have other models or other sources I can help on testing.

GLTF imports would natively accept animations too, right?

Regards, Pablo.