loadobject (loadmesh) with texture simple

Started by Santiago, May 20, 2020, 01:33:01

Previous topic - Next topic

Santiago

ok. i just make my first aproach to load object with texture in simple way.

what i discover.
in .3ds works better than .obj, i don't know why.
is important to use short name for textures, because large name are cut, i don't know why that too.

This method works for me now, i use the chafari post to know commands for make this small code.

in the future, i go to try to load more textures, mor properties like color, alpha and make a function to simulate blitz3d Loadmesh - loadanimesh function.


i tested whit a hangar for tora tora tora, a 3dsmax 3 objects, whit 3 materiales
i clean the scenes material 2 times to have a clean file.


file$ = "menu_hangar.3ds"
path$ = "\objects\menu\"
menu_obj = loadobject(path$ + file$,1)
childs = GetObjectNumMeshes(menu_obj)
for i = 1 to childs
textura$=GetObjectTextureName(menu_obj,i)
textura$ = path$ + textura$
menu_tex = loadimage(textura$)
setobjectmeshimage(menu_obj,i,menu_tex,1)
  next i

blinkok

#1
Quoteis important to use short name for textures, because large name are cut, i don't know why that too.
This is legacy to conform with the old MS-DOS 8 char filenames

Have a look at this thread, if the script is not there, maybe you could ask the author, jack, for a copy

.obj format is text based. I made an app to split out all the groups into individual objects

To be honest i think Jack's script would work best for you


iWasAdam

both .obj and .3ds are very ols with .obj being ancient. They both come from the 16/32bit DOS era and work best with DOS filenames. E.G.
12345678.123
spaces in filenames or long file names will cause problems. Also make sure the filenames exactly match the case. E.G
Abcedf.abc <> aBCdef.AbC
Mismatched case will cause issues across platforms. Where Windows wont care, and Mac/Linux will throw a fit...

Santiago

ahhh, thanks guys,

the script of the post, is realy good!, i trying to contact Jack! thanks!!

i guest .X is a good 3D file today?, i


I didn't know about files and formats, if I noticed that each one worked very differently.

nowadays the .FBX extension is used, which is from autodesk for everything that is 3D works, Lumion - 3Dsmax and other architectural software.

but I didn't see it being game friendly.

although I still lack knowledge, I see that there is light in the future about agk, I just need time to learn and solve everything that comes up.

Thank you very much! You have helped me a lot!

Skaven

.x is still a super old format, and FBX is a proprietary file format.
You'd most likely use glTF/GLB today, but I very much doubt old AGK supports such things.