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 Classic Chat / 3D Object with multiple textures not working?

Author
Message
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 26th Jan 2016 22:08
Hello everybody.

I tried to load a 3d model in .x format, which had multiple different texture applied to different part of the model, which was set up in Milkshape3D.

However when I tried to load the model using LoadObject(), the textures did not show up.

So I tried to texture the object using those textures that I load manually using LoadImage(), and applied them using SetObjectImage().

But it seems that the textures just wrap around the model indiscriminately, regardless of how I set them in Milkshape3D. The textures did not textures the specific part it's supposed to.

This is quite strange because in DBPro, when and .x object is loaded, all the textures are laoded automatically to its appropriate part on the model.

Any thoughts on this?
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 27th Jan 2016 07:27
For multi-texture object, you should use LoadObjectWithChildren()
Your export must be with several object, each with one texture.
For example :
- a car with his texture
- the ground with his texture
- a tree with his texture

When you export, you select the 3 objects.
You have : One file (.x or .dae) and 3 textures.
In AppGameKit, you load them with LoadObjectWithChildren() and set the texture with SetObjectImage().
AGK2 tier1 - http://www.dracaena-studio.com
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 27th Jan 2016 07:46 Edited at: 27th Jan 2016 08:01
In Milkshape 3D, it divides the model into multiple 'group'.
Each 'group' was assigned a texture.

I loaded the object using LoadObjectWithChildren() (1 object, 5 textures)
But no texture was applied.
So i tried to texture it using SetObjectImage()
But the texture was still not applied correctly.
And how do I texture a single object with that multiple texture?

Or must I export the components separately? (1 object for head, 1 object for body, and more objects for limbs?)

This is the code that I used to load it



Here's the example model. Please try to load it

Attachments

Login to view attachments
MarcoBruti
12
Years of Service
User Offline
Joined: 20th Nov 2011
Location: Caput Mundi
Posted: 27th Jan 2016 13:18 Edited at: 27th Jan 2016 13:32
Have you tried to load the model using directly the Milkshape3D format (.ms3d files)?

[EDIT] I have tried, no textures have been loaded You should use setObjectMeshImage(), I have used it to apply a different mesh to a soldier and the gun.
Here is the piece of code I use in my FPS:
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 27th Jan 2016 13:36
Yes I did load the model using directly the Milkshape3D format (.ms3d files). Still no textures
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 27th Jan 2016 14:25 Edited at: 27th Jan 2016 14:28
I repaired the model. Some part of it was broken in previous post.
It can be opened in DBPro correctly with its appropriate textures.
But when I tried to load in in AppGameKit, there are no textures.
I tried to apply the texture manually in AppGameKit, but still no success.

I also tried to texture it using SetObjectMeshImage( ), still no success

How do we even apply multiple textures on a single model?
Why didn't .x model loaded with its textures?

Here's the repaired model in ms3d and .x:

Attachments

Login to view attachments
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 28th Jan 2016 16:43 Edited at: 28th Jan 2016 16:43
Err anybody can get this to work?
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 28th Jan 2016 22:47
For some reason Milkshape is outputting UVs outside the normal 0.0 to 1.0 range. AppGameKit can accommodate this if all the images are a power of two in size (unlike DBPro which can set it in all cases by default), thankfully in your case this is true. The following code will apply the necessary wrap mode to the images
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 29th Jan 2016 07:42 Edited at: 29th Jan 2016 07:44
Thanks a million!

So that's how you apply multiple textures

I never knew Milkshape did that (and probably never will).

Also sorry for taking you guys times
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 1st Feb 2016 14:15
Sorry, I have another question.

AGK seems to use simple transparency. In this model, If we enable transparency, the eye will be invisible.

Is there any way to enable depth-buffered transparency with alpha reference?

Login to post a reply

Server time is: 2024-04-26 07:20:44
Your offset time is: 2024-04-26 07:20:44