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 / Trying to understand CreateMemblockFromObjectMesh()

Author
Message
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Dec 2018 00:00 Edited at: 12th Dec 2018 00:02
So i am loading in a model, The kenney furniture model BathroomCabinet.obj (Attached)
I count 32 vertex in the vertex table in the .obj file but i get a different value (100) from CreateMemblockFromObjectMesh()

What am i missing here?

The values are the first 6 integers in the mem block

Attachments

Login to view attachments
fubarpk
Moderator
14
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 12th Dec 2018 00:27
how are you getting the vertex count from the memblock?

Think puzzler may know this solution
fubar
Golelorn
2
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 12th Dec 2018 01:20
Are you starting at 0 or 1?

GetMemblockInt(memblock,0) is to find the vertices.
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Dec 2018 01:41
this is the code;
print("1="+str(GetMemblockInt(mesh, 0)))
print("2="+str(GetMemblockInt(mesh, 4)))
print("3="+str(GetMemblockInt(mesh, 8)))
print("4="+str(GetMemblockInt(mesh,12)))
print("5="+str(GetMemblockInt(mesh,16)))
print("6="+str(GetMemblockInt(mesh,20)))
Golelorn
2
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 12th Dec 2018 02:33
There are 64 tris, and 36 Verts when I open blender.

That can't be a coincidence that those total 100.

I don't have enough experience to explain that. Maybe the program he used to model these was a little wonky?
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Dec 2018 04:02 Edited at: 12th Dec 2018 04:02
Ultimate Unwrap says 108 polys and 32 vertex. There are duplicate faces though

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 12th Dec 2018 06:58 Edited at: 12th Dec 2018 07:27
Hello

You have 32 Vertices and 108 Faces in that model

All comprised having a bathroom door, bathroom cabinet, wood material, wood Dark material, and metal materal.

Edit... You have groups in here, and if your getting 100 and the OBJ file is 108, the only group I see is not seeing is possibly one of the usemtl's

usemtl woodDark

f 29/77/6 12/61/6 9/78/6
f 9/78/6 10/79/6 29/77/6
f 10/79/6 30/80/6 29/77/6
f 10/79/6 31/81/6 30/80/6
f 12/61/6 29/77/6 32/82/6
f 32/82/6 11/63/6 12/61/6
f 32/82/6 31/81/6 11/63/6
f 31/81/6 10/79/6 11/63/6

There are 8 here - so maybe missing this material in AGK

Ill check deeper once I get home


Double EDIT:


f = 108 / 3 = 36
v = 32
tri = 32
= 100

blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Dec 2018 08:48
Ok so it's a dodgy model. Just my luck
puzzler2018
User Banned
Posted: 12th Dec 2018 10:16
You may not have, here is the calculation AppGameKit does

faces = 108 / 3 = 36
vertices = 32
triangles = 32 (or double vertices)
which does = to what your getting - 100

Is it something that the model is not showing you correctly when your loading it or something? like looks all messed up or pieces missing or something, is this why your quering.

Or just like general knowledge on how it works?


blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Dec 2018 11:18 Edited at: 12th Dec 2018 11:18
Thanks puzzle dude. I'll check it tomorrow
puzzler2018
User Banned
Posted: 12th Dec 2018 12:48
If you like a little knowledge on how to build memblocks like with color / texture attributes etc from scratch then ill be more than happy to guide you in the right direction
puzzler2018
User Banned
Posted: 12th Dec 2018 17:52 Edited at: 12th Dec 2018 17:58
I think it could be a bad OBJ, just tried it with my meshmemblock stuff and it looks really odd - unless its my eyes

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 12th Dec 2018 17:57 Edited at: 12th Dec 2018 18:06
Loading it in AGKs version is indeed getting 100 and just seems a rectangular box with nothing else

[img]null[/img]


EDIT

Yes a corrupt OBJ file - the file has Groups and they dont have some of the G's in there for other parts - AppGameKit requires this

My version just grabs all V's, VT's, VN's, F's no matter where they are in the file - thats why can see a little bit more
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Dec 2018 18:53
Thanks puzzle dude. That helps a lot. I can imagine i would have been stuff about with it for a while
puzzler2018
User Banned
Posted: 12th Dec 2018 19:51 Edited at: 12th Dec 2018 19:52
I have manually removed the odd balls and now looks better with AGKs

You may need to re-add the door (as this was in the file assosciated with a door!!)

Who is this Kenny anyway

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 12th Dec 2018 20:22
Done it - found the culprit - and it was the 8 lines that i posted earlier - manually remove them and it now a cabinet!!!

Attachments

Login to view attachments
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Dec 2018 20:34
Thanks puzzle dude. Kenney makes heaps of free models
puzzler2018
User Banned
Posted: 12th Dec 2018 20:54 Edited at: 12th Dec 2018 20:54
Your welcome and thanks

Kevin Macleod does royalty free nice music too

https://incompetech.com/music/


As well as

Eric Matyas with free music / sound effects

https://forum.thegamecreators.com/thread/216859

A game is never complete without these

Login to post a reply

Server time is: 2019-04-19 01:06:00
Your offset time is: 2019-04-19 01:06:00