May 31, 2020, 09:37:49 PM

Author Topic: loadobject (loadmesh) with texture simple  (Read 116 times)

Offline Santiago

  • Full Member
  • ***
  • Posts: 215
  • Blitz3d
    • Indiesoft
loadobject (loadmesh) with texture simple
« on: May 20, 2020, 01:33:01 AM »
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.


Code: [Select]
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

Offline blinkok

  • Full Member
  • ***
  • Posts: 170
Re: loadobject (loadmesh) with texture simple
« Reply #1 on: May 20, 2020, 05:23:35 AM »
Quote
is 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


Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1718
Re: loadobject (loadmesh) with texture simple
« Reply #2 on: May 20, 2020, 05:27:15 AM »
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...

Offline Santiago

  • Full Member
  • ***
  • Posts: 215
  • Blitz3d
    • Indiesoft
Re: loadobject (loadmesh) with texture simple
« Reply #3 on: May 20, 2020, 03:59:09 PM »
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!

Offline Skaven

  • Jr. Member
  • **
  • Posts: 5
Re: loadobject (loadmesh) with texture simple
« Reply #4 on: May 20, 2020, 04:08:53 PM »
.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.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal