Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Chat / How would I use a multitexture Milkshape model?

Author
Message
Bob Sherman
1
Years of Service
User Offline
Joined: 15th Jul 2016
Location:
Posted: 5th Jan 2018 05:47
I remember how easy it was to use Milkshake 3d with dark basic. You could just export it as .x and a multi textured model would work. It seems that's not the case with AGK2. I wanna make my levels and characters like Nintendo 64 multi textured characters.
CJB
Valued Member
14
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 5th Jan 2018 12:03
You can texture individual meshes within the model with separate textures.
Bob Sherman
1
Years of Service
User Offline
Joined: 15th Jul 2016
Location:
Posted: 5th Jan 2018 12:33
I have done that, but when I load the model, it doesn't load the textures.
MikeHart
AGK Developer
14
Years of Service
User Offline
Joined: 9th Jun 2003
Location: Germany
Posted: 5th Jan 2018 13:31 Edited at: 5th Jan 2018 13:32
How do you load the model? In AppGameKit you have to manually assign the textures to an object. They are not loaded and assigned automatically. For whatever reason the aGK creators had in mind. I am still scratching my head about this.
Running Windows 7 Home, 64 bit, 8 GB ram, Athlon II X2 255, ATI Radeon HD 4200. Using AGK2 Tier 1.
CJB
Valued Member
14
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 5th Jan 2018 14:04
Yes, Mike is correct - that's what I meant. Within AppGameKit, you need to individually texture each mesh using the SetObjectMeshImage command. So, you need to load each image used in your model using LoadImage, and assign the image to the relevant mesh within your model. I agree that this can be frustrating. I'd love it if loadobject could also load all the required textures and bump maps etc. and assign them to the correct meshes automatically. Maybe there is a technical reason this isn't the case?
DMJ
6
Years of Service
User Offline
Joined: 6th Sep 2011
Location: Australia
Posted: 6th Jan 2018 06:50
That is dumb. How would you create a multi textured level in another piece of software and import it? All of my models use different textures..... That is a giant face palm.
Jeff Miller
13
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 6th Jan 2018 12:43
In your case it certainly requires more programming statements. However, there is an upside to the way AppGameKit forces it in other cases. In some games many different models may be using textures that other models are also using. In DBP, this resulted in loading the very same texture many times when loading the complete models with texture references. One forum member, Cash Curtis, substantially reduced his game's loading time by loading each texture only once and texturing the models within the program.
Bengismo
Recently Online
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 6th Jan 2018 18:26 Edited at: 6th Jan 2018 18:29
It would be useful if there was an OPTION to load relevant texture images from the 3d file being loaded but its not always the case that you always want images loading for you.
Another option might be a function for getting the Texture Filenames from a loaded 3D object if they were stored in the model file.

As it is....Its just 2 lines of code vs 1 line of code.

id = LoadObject("xxx")
SetObjectImage( id, LoadImage("xxxTexture") , 0 )

(Not really hard work)
Since you know what model your loading then you should also know what image files it needs.


As Jeff has aid above ...the separate loading of textures and models allow you to do various things that you cant do if every model loaded its own textures.

You can have two characters in your game that use the same model but different textures (2 textures - 1 model) - multiple skins
You could have many different models using one texture (like an atlas texture) to speed up rendering and share resources (1/2/3/4/5 models - one texture) - thers no point in loading this one texture many, many times. it will just slow down the game and eat up memory!!
You might want to share a reflection map between many models in a scene.
You might want an object (a character) to be able to get blood on his texture so a different texture is loaded depending on what circumstances he is in...etc...
You might want to resize the loaded image on certain platforms so models on mobiles scale down the texture size.

The most important thing is that you have full control over what texture is used at any given time so if your 3d model isnt using it you can delete it and save memory etc...

If we did have it automatically loading images for us then we would also want to get the ID of that texture image that was loaded so that you dont accidentally load another texture into that ID location.


ONE VERY SIMPLE SOLUTION I HAVE USED:
If your filename for the texture has the same name as the 3d model then you can write your own function in about 1 minute that will auto load the model and the texture for you



So you just use one line of code but a texture is loaded for you and set to the object as long as it is named the same as the model file.
Green7
12
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 8th Jan 2018 14:52
Thats all ok, but i see the point, as if you got a level stuffed with many single meshes and you have to texture every single mesh of a object, then it needs some work, depending on the number of meshes in one object.
janbo
9
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 8th Jan 2018 16:02 Edited at: 8th Jan 2018 16:04
AGK uses Assimp to load the 3D Files which is capable of loading textures strings from many 3D formats so this is a good feature request I think.

Command:
GetObjectMeshImageString(ObjectID,MeshID,StageID)

Usage:
Bengismo
Recently Online
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 8th Jan 2018 21:25 Edited at: 8th Jan 2018 21:32
Nice! That's similar to what I was thinking. It should work fine. I totally agree that we need to get the image filenames from the loaded object via a function like yours or have a separate Loader function to load the object and textures for us. This does require new AppGameKit functions though.

Your usage code can then becomes the filling for a LoadObjectWithTextures() function to make it easy to have a one line solution for loading models and textures nice and easy.

I'd also like to see GetObjectMeshImage(ObjectID,MeshID,StageID) so we can get image id's and release resources later on easily. I cant find this?? The engine stores these image ID's so it would be good to get them back later.



Until we get a new function, I tend to keep using the file naming strategy and do the following filenaming:
Model.x (Object to load)
Model1.png (Texture for mesh1 of model)
Model2.png (texture for mesh 2)
Model3.png (texture for mesh 3)


Then use similar code to this:


Then you can load a model file with multiple meshes and multiple textures with one function call. If no texture files are stored, then none are set into the mesh. Its possible to extend this to even include texture stages too if wanted.
Scraggle
VIP Member
14
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 8th Jan 2018 21:35
I use an XML file that holds texture names for each stage/mesh along with all the animation frames. It also holds the default local rotation - that only really comes in handy for a quick view but it's still usefull.
Then I call my own Load3Dobject() function which looks for an XML file with the name {objectname}_objectdata.xml
If the XML doesn't exist the file is loaded as normal. If it does exist then all associate textures, animation data etc is loaded along with the object.
Bengismo
Recently Online
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 8th Jan 2018 21:51
Cool.... thats a good way of doing it....A text file would also work as thats what I used to do, but I got tired of actually creating and filling in the text file with filenames and resorted to just filenaming instead

I like the LoadSkeleton2DFromSpriterFile( filename, scale, atlasImage ) Its cool if you have Spriter and this handy function loads the Animations and all the textures(images for you). Obviously only useful for 2D but I guess people want something similar for 3D too.

Login to post a reply

Server time is: 2018-04-24 13:39:27
Your offset time is: 2018-04-24 13:39:27