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.

Newcomers AppGameKit Corner / [SOLVED] AGKS Importing and Texturung 3D Scenes

Author
Message
Dark_ITheI _Angel
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location:
Posted: 26th Nov 2022 19:49 Edited at: 26th Nov 2022 20:02
I hope somebody could help me here a little i already wasted a week in this.

I have a scene with only 3 cubes , I want to be able to assign a texture to each cube. So i Export it as .FBX and import into AGKS , then i use SetObjectImage to texture the main object Then SetObjectImageMesh to texture the second and same with the third.
But it is Not working, Or it sets one texture to both cubes or it sets to all cubes. This time SetObjectMeshImage dont give me the error that am out of range, so that lets me know 3 separate objects exist,but i can still not texture them independently.

This is my code :



I try different export options from blender as in the begin it wouldnt even detect the separate objects,No matter wich file format, i made sure each object has an image map assigned in the scene,in this case every single cube, still i dont know why it dosnt work.
In this case i should have 2 cubes with Leaves Texture and One with Bark texture .
SetObjectImage(Map,leaves,0)
SetObjectMeshImage(Map,1,Leaves,0)
SetObjectMeshImage(Map,2,Bark,0)

Any Ideas? I know it work for others, i just cant figure it out.
Animals

Attachments

Login to view attachments

The author of this post has marked a post as an answer.

Go to answer

Dark Raven
10
Years of Service
User Offline
Joined: 27th Jul 2014
Location: United States
Posted: 26th Nov 2022 23:01
I think what it is doing is because you are SetObjectImage(Map,Leaves,0) It is texturing the whole object file and I think it may be overriding the mesh image commands. Try only using SetObjectMeshImage for all three cubes and see if that works.
3D isn't my expertise so I may be wrong in this but it couldn't hurt to try.



Again Don't know if that will work or not but can't hurt to try.
Dark_ITheI _Angel
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location:
Posted: 27th Nov 2022 00:00 Edited at: 27th Nov 2022 00:39
That was also my thinking but sadly that isnt it. SetObjectMeshImage gives me the error that am out of range with the 3rd,. With the Tree, i textured the trunk with SetObjectImage and the leaves with SetObjectMeshImage and it worked but just 2 objects,leaves and trunk,as soon as its a third object it dont let me, but did happen also with 2 !
Am just trying to figure out how one would go to texture a scene with 100s or 1000s of object . it would be crazy to import every object one by one. am even staring to think that more than 2 textures cant be applied per fbx file, but that dont seem reasonable.
Am surely doing something wrong.

Thank you for trying,i notice much people here prefer 2D, maybe less headache

Edit : Funny enough, i have now 4 cubes but i can only texture 3 of them, 2 of them takes the same texture and using SetObjectImage ( as in main object + 3 children) dont help and the 4th is out of range. wtf
Animals

Attachments

Login to view attachments
ando
4
Years of Service
User Offline
Joined: 21st Feb 2020
Location: Australia
Posted: 27th Nov 2022 00:42 Edited at: 27th Nov 2022 01:04
Maybe check how many meshes.
meshes=GetObjectNumMeshes(Map)

and in the loop
Print(" "+str(meshes))

edit- also look at SetObjectMeshUVScale
BASIC appeared in May 1964. Lightning flashed, the wind roared and the Earth moved.
And nine months later I was born.
So here I am.
I am Basic.
Code is in my genes.
Dark_ITheI _Angel
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location:
Posted: 27th Nov 2022 01:14
Thanks Ando, That helped.

I was looking at getobjectnum just didnt know how to print it. It say i have only 3 meshes when should be 4 .
So the problem may be Blender but why does it ignore 1 mesh . Will try changing some things in blender maybe it ignores the main object,so many things changed in blender like collections, could be something there.
Atleast i know now AppGameKit just see 3 meshes
Animals
ando
4
Years of Service
User Offline
Joined: 21st Feb 2020
Location: Australia
Posted: 27th Nov 2022 02:03 Edited at: 27th Nov 2022 02:07
I use milkshape3d because it's easy to use.
Blender looks cool but it's too much for my brain.

iirc, does blender start with a default cube?
Maybe delete the original cube and make your own.

Actually, it sounds like it's making 2 cubes into 1 mesh.
BASIC appeared in May 1964. Lightning flashed, the wind roared and the Earth moved.
And nine months later I was born.
So here I am.
I am Basic.
Code is in my genes.
Dark Raven
10
Years of Service
User Offline
Joined: 27th Jul 2014
Location: United States
Posted: 27th Nov 2022 04:56
might try exporting to .obj or dae and see if the same thing happens. Maybe its how blender is exporting fbx.
Dark_ITheI _Angel
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location:
Posted: 27th Nov 2022 17:42
@Ando,

I did delete the default cube But that dont help. I guess its just the way how blender export and wich version of fbx AppGameKit supports fully. I did yesterday add a cube,assign a material map and export it again as fbx and it now tells me i only have one mesh. No changes done other than add a cube, like everytime i export the same scene AppGameKit change something, be it the rotation,the meshes it reads and so on, really weird.
I will try Milkshape, atleast to see if i could export there and from there to agk. thanks for the tip.

@DarkRaven

I tried every format, Dae, .x , Fbx , .Obj , i still get the same results, actually worst ones. The code isnt it but am reading how many versions there are of the Fbx Format, i guess obj or dae will be the same, it could be AppGameKit only full support, lets say Fbx 2015 version.
i will keep trying and upload the project here, it cant be this only happens to me when much people use blender here also ...
Animals
Dark_ITheI _Angel
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location:
Posted: 27th Nov 2022 17:51 Edited at: 27th Nov 2022 17:54
This Are the project Files, AFAIK my pc dont have viruses .., Inside are different fbx files and also in obj or dae, wich this time it dosnt even show.
Maybe if you guys have a little time and check it or some other kind soul here, would be really great.
Animals

Attachments

Login to view attachments
ando
4
Years of Service
User Offline
Joined: 21st Feb 2020
Location: Australia
Posted: 27th Nov 2022 19:02
With milkshape, I usually export B3D (Blitz3D) format models. Static or animated have been pretty reliable for me and AGKS.
Milkshape can't import B3D so I always save my models as Milkshape file making it easy to reload and edit a model if needed.
BASIC appeared in May 1964. Lightning flashed, the wind roared and the Earth moved.
And nine months later I was born.
So here I am.
I am Basic.
Code is in my genes.
Dark_ITheI _Angel
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location:
Posted: 28th Nov 2022 00:46
Question is if .B3d supports Multimesh. I was having a talk on discord and got told not all formats support multimesh. (something the manual dont tell )
I did import into MS3D and Exported as .B3D. Milkshape shows there are 4 different cubes yet AGKS see it as only one object.

I did try FBX and was the same problem, guess i will just have to keep trying. I just dont know where the problem is but to be honest this shouldnt be a problem,something so simple and basic, but well , lets keep trying.
Animals

Attachments

Login to view attachments
ando
4
Years of Service
User Offline
Joined: 21st Feb 2020
Location: Australia
Posted: 28th Nov 2022 01:18
I made a little "waves" demo about 10 years ago and recently ported it to AGKS just as a learning experience.
The terrain model is B3D and is 1 object with 5 meshes. So I only just learned how to use those mesh texture commands a couple weeks ago and it seems to work ok.
The waves demo with code is here...
https://forum.thegamecreators.com/thread/228751#msg2672392
BASIC appeared in May 1964. Lightning flashed, the wind roared and the Earth moved.
And nine months later I was born.
So here I am.
I am Basic.
Code is in my genes.
ando
4
Years of Service
User Offline
Joined: 21st Feb 2020
Location: Australia
Posted: 28th Nov 2022 05:42
I played with your project.
Using milkshape exports...

Not working - fbx, obj

Working - dae, ms3d, b3d

I also changed your code a bit here and there.

BASIC appeared in May 1964. Lightning flashed, the wind roared and the Earth moved.
And nine months later I was born.
So here I am.
I am Basic.
Code is in my genes.
Dark_ITheI _Angel
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location:
Posted: 29th Nov 2022 12:04
Thats really nice from you ando for taking the time,i will try that as soon as i get home. I was exporting .dae directly from blender and had the same problem, .b3d i did also from ms3d and wouldnt work, maybe the code or corrupted file as i export from blender... Lets see but nice to know the problem is not agk but the way am doing it.
Animals
ando
4
Years of Service
User Offline
Joined: 21st Feb 2020
Location: Australia
Posted: 29th Nov 2022 12:10 Edited at: 29th Nov 2022 12:12
No worries mate.
I just noticed one of my uploads didn't work, I'll try again.
BASIC appeared in May 1964. Lightning flashed, the wind roared and the Earth moved.
And nine months later I was born.
So here I am.
I am Basic.
Code is in my genes.

Attachments

Login to view attachments
Dark_ITheI _Angel
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location:
Posted: 29th Nov 2022 18:49 Edited at: 29th Nov 2022 18:52
Your MS3d file works, i get 4 meshes. But with my own i just get 1 mesh. To make sure i started a new project in agk , did 4 cubes in MS3d and exported as Ms3d, Dae and b3d but it dont work, i still get one mesh as you can see in the picture but loading your 4cubes it gives me 4... thx again but i give up on this one for now,maybe i figure out in the future what on earth is the problem.
Animals

Attachments

Login to view attachments
Dark_ITheI _Angel
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location:
Posted: 29th Nov 2022 20:45 Edited at: 29th Nov 2022 21:15
I found the problem, something easy yet not very obvious. Objects must have a material assigned, wich i did, Yet one have to change the base color else AppGameKit will not recognise the meshes. 1 object dont need the base color change to be recognised but 2 out of 3, 3 out of 4 and so on.
Before i did also texture my object inside blender but that didnt work either, base color cant stay same, atleast thats what i see. Milkshape also worked fine but need further tests. I did a little video to showcase the problem and the fix, should someone have the same luck like me.

https://www.youtube.com/watch?v=Gy3GN4UDicg
Animals

Attachments

Login to view attachments
ando
4
Years of Service
User Offline
Joined: 21st Feb 2020
Location: Australia
Posted: 30th Nov 2022 23:03 Edited at: 30th Nov 2022 23:09
I was curious so I did some tests in milkshape coz I don't know blender.

I made a sphere, selected some faces then selected regroup.
So now the sphere has 2 groups but it still shows up as 1 mesh.
After I assign a texture to that group in milkshape then it becomes a separate mesh.

I still have to load and apply the texture in AGKS for it to be seen.
BASIC appeared in May 1964. Lightning flashed, the wind roared and the Earth moved.
And nine months later I was born.
So here I am.
I am Basic.
Code is in my genes.
Dark_ITheI _Angel
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location:
Posted: 1st Dec 2022 05:13
This post has been marked by the post author as the answer.
Exactly, You need to assign a texture or you have to change the Diffuse color else AGKS will not recognise the separate mesh, in both,blender and MS3D.
So AGKS not only need the mesh to have a Material but it needs a change in that material(by texture or diffuse color) for it to be able to recognise it.
Not exactly a dealbraker but something important to know wich sadly i didnt find any information about it in the manual (command description) nor searching the forums.

Well, happy i can move on to the next problem .

Animals

Login to post a reply

Server time is: 2024-11-21 12:37:38
Your offset time is: 2024-11-21 12:37:38