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 / ..Object (Mesh) parts access..

Author
Message
Naughty Alien
6
Years of Service
User Offline
Joined: 26th Jul 2017
Location:
Posted: 29th Aug 2017 10:25
..hi guys..i would like to know, how should i load a mesh (3D object) which consists from many parts (non animated, just static geometry), and then access each object within loaded mesh individually ??

I have tried to load mesh with LEVEL=LoadObjectWithChildren("RUIN.b3d") and then, print(str(GetObjectNumChildren(LEVEL))) , just to see how many objects exists within loaded mesh. Result I receive is 0, even mesh itself does contain 4 objects..what am i doing wrong ??
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 29th Aug 2017 17:23
I have also had a problem with "GetObjectNumChildren" when loading the masked soldier from GameGuru (only one I have tried so far), it returns 0 but when setting textures I have to set mesh 1,2 and 3 to set the texture correctly so I'm also a little confused.
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 29th Aug 2017 18:25
I can make lightwave save separate parts as meshes by assigning separate surfaces.
Also, exporting a scene file (don't know what the blender equivalent is) allows me to access the separate entities as bones if loaded with LoadObjectWithChildren().

I think I may have had to add a key frame or 2 to certain parts.

Maybe convert the model with something to see if it fixes it up? I had to do a lot of this before I found a way to get Lightwave format working for me.
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 29th Aug 2017 19:53
My own fault for not checking the other functions, "GetObjectNumMeshes" returns the correct number of meshes (3 in my case), the masked soldier has no child objects!

I'm wondering though if I import a gun into the masked soldier object and export is the gun treated as a child object or more meshes .... guess I need to crack open Blender and experiment a little.
Naughty Alien
6
Years of Service
User Offline
Joined: 26th Jul 2017
Location:
Posted: 30th Aug 2017 03:28
..one of the reasons why im asking about this is, lightmaping..it seems, lightmap, as well as other textures attached to 3D model, are not automatically assigned to 3D model, even information about textures used are within 3D file..so it seems, its needed to go trough hierarchy of 3D file and find each child and then attach corresponding texture to texture it, which is a bit weird..
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 30th Aug 2017 18:46
its so we can use multiple texture objects, UV mapping a complex object to a single texture can be a tiresome job and its very hard for a novice like me to get right so I welcome this system, also some objects you get from 3D model sites have multiple textures.

for an object you know uses a single texture you can simply make a function to load the image into all meshes

Naughty Alien
6
Years of Service
User Offline
Joined: 26th Jul 2017
Location:
Posted: 31st Aug 2017 04:07
..thank you PartTimeCoder..your code sample also doesn't work...do you mind to try yourself media i have put in attachment ? Inside is completed scene done in Gile[s] (its free) , with generated lightmap as well..diffuse textures are all TGA, which AppGameKit doesnt read, if i understand correctly, but lightmap is PNG which is fine..exported level is in B3D format (RUIN.B3D)...here is screenshot how it supposed to look like (Gile[s]) and objects names are visible (minus light source, rest is geometry Plane01 and so on) ..



..and rendered from Blitz3D..

Attachments

Login to view attachments
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 31st Aug 2017 11:16 Edited at: 31st Aug 2017 11:21
you will need to convert the textures to png, install Paint NET and open the images, save each one as png



Attachments

Login to view attachments
Naughty Alien
6
Years of Service
User Offline
Joined: 26th Jul 2017
Location:
Posted: 31st Aug 2017 15:35
..thank you very much..this works so far..i have 2 questions..

1) How do you know which meshIndex belong to particular imageID, in command SetObjectMeshImage(ruin, 1, RuinT05, 0)
2) How should I attach provided lightmap to given mesh (ruin.b3d) ? I did try to do this SetObjectImage(ruin,lmp,1) , as well as this, for each individual meshIndex, SetObjectMeshImage(ruin, 1, lmp, 1) , but it doesn't work(Lightmap is tiled over mesh in either case i tried)

PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 31st Aug 2017 15:57 Edited at: 31st Aug 2017 15:59
Quote: "1) How do you know which meshIndex belong to particular imageID, in command SetObjectMeshImage(ruin, 1, RuinT05, 0)"


trial and error, I textured each mesh one at a time setting the correct image until I got them right.
Quote: "
2) How should I attach provided lightmap to given mesh (ruin.b3d) ? I did try to do this SetObjectImage(ruin,lmp,1) , as well as this, for each individual meshIndex, SetObjectMeshImage(ruin, 1, lmp, 1) , but it doesn't work(Lightmap is tiled over mesh in either case i tried)"


try:


I'm not sure it will work though as the light map uses the UV scale and offset, maybe one of the 3D gurus can help further.
Naughty Alien
6
Years of Service
User Offline
Joined: 26th Jul 2017
Location:
Posted: 31st Aug 2017 18:24 Edited at: 31st Aug 2017 18:25
...thank you for quick response...hmm..i was afraid to hear that, about trial and error...i mean, it is all fine when just few objects exists on the scene..but once level gets more complex, its quite a feat to just assign textures...its a bit weird that such thing which should be very straight forward indeed seems to be complex to achieve..

EDIT:
Code example for lightmap doesnt work..im not sure why..i really hope someone with complete understanding of how this should work in AppGameKit, cast some light on to this..
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 31st Aug 2017 19:49
on reflection (I am still learning the 3D system myself), you have the name of each mesh in the 3D editor so in theory you can use 'GetObjectMeshName' to be sure to assign the right texture to each mesh but in the case of your model and the masked soldier I am testing with it returns a empty string.

I am currently up to my elbows in plugin code and don't want to distract my attention from my current task but I need to understand this system and come up with some sort of standard for my next task I will investigate it further then.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 1st Sep 2017 00:16
I would look at the order of meshed in your 3D proggy and see if that matches the order in AGK
Naughty Alien
6
Years of Service
User Offline
Joined: 26th Jul 2017
Location:
Posted: 1st Sep 2017 02:20 Edited at: 1st Sep 2017 02:36
Quote: "I would look at the order of meshed in your 3D proggy and see if that matches the order in AGK"


...do you mind to elaborate this, please ? How to do that ?

EDIT 1:
Regarding GetObjectMeshName, it returns nothing...i would really love to see some proper description how to do lightmaping with AGK..if way i have put scene together wrong, then it will be good to know what im doing wrong..

for i=1 to 6
print(GetObjectMeshName(ruin,i)) //this prints nothing
next


EDIT 2:
I have just created scene in 3dsmax, as simple as it can be..just 2 boxes with no textures, but with given names Box01 and Box02..exported as FBX and loaded without problem (both boxes visible)..again, i simply cant get objects name no matter what command i try (all suggested commands so far)...eh..I really came to conclusion that, there must be me doing something very wrong because such trivial task seems to be an issue..or mentioned AppGameKit commands simply does nothing..
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 1st Sep 2017 10:50
Ok, i just did the same in blender, added 2 boxes to 1 mesh and a single box on its own mesh, named the 'objects', loaded it up in agk and sure enough its printing the 'mesh' name, not the object name (I guess this is the expected result), so be sure you are naming your meshes along with your objects.





I don't use 3dsMax so I dont know how its laid out but maybe my findings above can shed some light on the naming process
Naughty Alien
6
Years of Service
User Offline
Joined: 26th Jul 2017
Location:
Posted: 1st Sep 2017 13:17
...for some reason, i cant get it work..do you mind to share with me your file (boxes) and list of mesh names so i can try myself..according to 3dsmax, everything is proper and names are set as expected..

PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 1st Sep 2017 13:37
sure, the fbx is attached

Attachments

Login to view attachments
Naughty Alien
6
Years of Service
User Offline
Joined: 26th Jul 2017
Location:
Posted: 1st Sep 2017 13:55
..your file works as expected..do you mind to share with me which version of FBX exporter do you use ?? And if it is not much to ask, can you reexport it again, but in ASCII format so i can see its structure and check difference with one i have exported from 3dsmax..
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 1st Sep 2017 15:22
I used standard fbx export settings from Blender 2.78 which uses FBX 7.4 for binary and 6.1 for ASCII, I can not seem to get AppGameKit to load fbx in ascii format but I have attached it for you to view, I have also attached the .blend file in case you want to install blender and experiment yourself



Attachments

Login to view attachments
Naughty Alien
6
Years of Service
User Offline
Joined: 26th Jul 2017
Location:
Posted: 1st Sep 2017 15:35
..thank you very much for effort...i will try your file and see how it goes..

I can not seem to get AppGameKit to load fbx in ascii format
This is interesting, because, ASCII FBX(as well as binary) i did export from 3dsmax, is loaded/works just fine...mmm
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 1st Sep 2017 17:48
I don't think there is a standard with regards to mesh names as I get differing results with each export type, .fbx, .dae, .obj and .x all give different results, I'm getting flipped normals with .x and .dae and no mesh names, .obj normals are fine but again no mesh names and .fbx binary is the only consistent result, fbx ascii wont load at all, I'm even more confused now then when I started! lol

Naughty Alien
6
Years of Service
User Offline
Joined: 26th Jul 2017
Location:
Posted: 2nd Sep 2017 03:57
...i have just filled up survey (GameCreators) and complained about this..i hope someone there will read that..in main time, i have no progress whatsoever..so all i have to do is basically blind experiments, until 'something' works...thats a bit setback as i was planing to use this system for commercial purposes (i did released games before with EA)...its too early to say am i giving up, so i will try a bit more and hope to get this work..
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 2nd Sep 2017 11:33
I am developing some tools to take the guess work out of rendering a 3D scene and importing models into AppGameKit taking what I have learned from this thread and applying a visual approach to the problem of texturing a multi mesh object, I have almost perfected my system and should have some results to show in a couple of weeks (work, life and obligations willing!)

Login to post a reply

Server time is: 2024-04-16 21:13:35
Your offset time is: 2024-04-16 21:13:35